create dest directory if not exists

This commit is contained in:
2023-05-05 08:14:29 +02:00
parent 52943e03be
commit b74cc0d633

View File

@@ -173,6 +173,7 @@ Public Class UpdateInstaller
Select Case action.Type
Case UpdateActionType.Update
Directory.CreateDirectory(Path.GetDirectoryName(destFilePath))
Dim sRemote As Stream = Await httpClient.GetStreamAsync(action.DownloadUrl)
Dim fs As New FileStream(destFilePath, FileMode.Create, FileAccess.ReadWrite)
Await sRemote.CopyToAsync(fs)
@@ -185,11 +186,13 @@ Public Class UpdateInstaller
Case UpdateActionType.Copy
Dim srcFilePath As String = Path.Combine(localPath, action.SrcPath)
If File.Exists(srcFilePath) Then
Directory.CreateDirectory(Path.GetDirectoryName(destFilePath))
File.Copy(srcFilePath, destFilePath, True)
End If
Case UpdateActionType.Move
Dim srcFilePath As String = Path.Combine(localPath, action.SrcPath)
If File.Exists(srcFilePath) Then
Directory.CreateDirectory(Path.GetDirectoryName(destFilePath))
File.Move(srcFilePath, destFilePath, True)
End If
End Select