EDMI: changes in newfile and updatefile method

This commit is contained in:
Jonathan Jenne
2022-02-08 16:29:43 +01:00
parent 5e44adccd7
commit 607f7e6445
8 changed files with 46 additions and 29 deletions

View File

@@ -138,26 +138,12 @@ Namespace IDB
Public Function GetFileObjectPath(pStore As GlobalState.ObjectStore, pDateImported As Date) As String
' Get directory by DateImported or, if not supplied, by current date
Dim oSubDirectory As String
Dim oFinalPath As String
If IsNothing(pDateImported) Then
oSubDirectory = FileEx.CreateDateDirectory(Now)
oFinalPath = FileEx.CreateDateDirectory(pStore.Path, Now)
Else
oSubDirectory = FileEx.CreateDateDirectory(pDateImported)
oFinalPath = FileEx.CreateDateDirectory(pStore.Path, pDateImported)
End If
Logger.Debug("Subdirectory is [{0}]", oSubDirectory)
' Check and create final path, if necessary
Dim oFinalPath = IO.Path.Combine(pStore.Path, oSubDirectory)
If Not IO.Directory.Exists(oFinalPath) Then
Try
Logger.Debug("Path does not exist, creating: [{0}]", oFinalPath)
IO.Directory.CreateDirectory(oFinalPath)
Logger.Debug("Created folder [{0}]", oFinalPath)
Catch ex As Exception
LogAndThrow(ex, $"Store Directory [{oFinalPath}] could not be created!")
End Try
End If
Logger.Debug("Final Directory is [{0}]", oFinalPath)
Return oFinalPath
End Function