clean up files properly

This commit is contained in:
Jonathan Jenne 2022-02-16 16:02:59 +01:00
parent d036ad00c2
commit 09f1684d81
2 changed files with 15 additions and 13 deletions

View File

@ -42,6 +42,19 @@ Public Class ClassFileHandler
End Try
End Function
Public Sub Clear_Tempfiles()
For Each oFile In TempFiles
Try
System.IO.File.Delete(oFile)
Catch ex As Exception
Logger.Error(ex)
End Try
Next
TempFiles.Clear()
End Sub
Public Function Decide_FileHandle(pFilepath As String, pHandletype As String) As Boolean
Try
''TODO: Before doing anything, clean the filename

View File

@ -269,7 +269,7 @@ Public Class frmStart
If IO.File.Exists(CURRENT_WORKFILE) = True And DTACTUAL_FILES.Rows.Count > 0 Then
Open_IndexDialog()
Else
Throw New FileNotFoundException("Dropped file does not exist anymore!")
LOGGER.Warn("Trying to index non-existent file [{0}]", CURRENT_WORKFILE)
End If
' If multi-indexing is active, all files have been indexed by now, so we can leave the loop
@ -285,7 +285,7 @@ Public Class frmStart
Finally
' Clear all temp files after indexing
Clear_Tempfiles()
FILE_HANDLER.Clear_Tempfiles()
EMAIL.Clear_TempFiles()
FileDrop.RemoveTempDirectory()
@ -565,17 +565,6 @@ Public Class frmStart
End Sub
#End Region
Private Sub Clear_Tempfiles()
'TempDateien löschen
For Each oFile In FILE_HANDLER.TempFiles
Try
System.IO.File.Delete(oFile)
Catch ex As Exception
LOGGER.Error(ex)
End Try
Next
End Sub
Sub Open_IndexDialog()
Try
Hide()