EDMI: changes in newfile and updatefile method
This commit is contained in:
@@ -349,10 +349,11 @@ Public Class File
|
||||
''' </summary>
|
||||
''' <remarks>
|
||||
''' https://docs.microsoft.com/en-us/dotnet/standard/io/handling-io-errors
|
||||
''' https://stackoverflow.com/questions/876473/is-there-a-way-to-check-if-a-file-is-in-use
|
||||
''' </remarks>
|
||||
Public Function TestFileIsLocked(pFilePath As String) As Boolean
|
||||
Try
|
||||
Using stream As FileStream = IO.File.Open(pFilePath, FileMode.Open, FileAccess.Read, FileShare.None)
|
||||
Using stream As FileStream = IO.File.Open(pFilePath, FileMode.Open, FileAccess.ReadWrite, FileShare.None)
|
||||
stream.Close()
|
||||
End Using
|
||||
Catch ex As Exception When ((ex.HResult And &HFFFF) = 32)
|
||||
@@ -388,9 +389,12 @@ Public Class File
|
||||
Dim oFinalDirectory As String = IO.Path.Combine(pBaseDirectory, oDateDirectory)
|
||||
|
||||
If IO.Directory.Exists(oFinalDirectory) = False Then
|
||||
_Logger.Debug("Path does not exist, creating: [{0}]", oFinalDirectory)
|
||||
Try
|
||||
Directory.CreateDirectory(oFinalDirectory)
|
||||
_Logger.Debug("Created folder [{0}]", oFinalDirectory)
|
||||
Catch ex As Exception
|
||||
_Logger.Warn("Final path [{0}] could not be created!", oFinalDirectory)
|
||||
_Logger.Error(ex)
|
||||
End Try
|
||||
End If
|
||||
|
||||
Reference in New Issue
Block a user