npoi
npoi copied to clipboard
CreateTempFile throws DirectoryNotFoundException for SXSSFWorkbook
Issue If the 'poifiles' folder is deleted after an SXSSFWorkbook has been created, creating another in the same process will fail
Since the dir reference of CreateTempFile is static and the temp file is created in the temp folder, there is no guarantee that the path will continue to be valid, as a clean up job may be running once in a while on the temp folder and delete the poifiles directory
Proposed Solution: Remove static dir variable and always call CreateDirectory as it will create the directory or just return the path if it already exists I can provide a PR with the fix if you agree on the solution
Steps to reproduce:
- Create an SXSSFWorkbook and register a sheet
- Save the workbook
- Delete the C:\Users\myUser\Local\Temp\poifiles folder manually
- Create another SXSSFWorkbook and register a sheet
- This has to happen in the same process