create dest directory if not exists
This commit is contained in:
@@ -173,6 +173,7 @@ Public Class UpdateInstaller
|
|||||||
|
|
||||||
Select Case action.Type
|
Select Case action.Type
|
||||||
Case UpdateActionType.Update
|
Case UpdateActionType.Update
|
||||||
|
Directory.CreateDirectory(Path.GetDirectoryName(destFilePath))
|
||||||
Dim sRemote As Stream = Await httpClient.GetStreamAsync(action.DownloadUrl)
|
Dim sRemote As Stream = Await httpClient.GetStreamAsync(action.DownloadUrl)
|
||||||
Dim fs As New FileStream(destFilePath, FileMode.Create, FileAccess.ReadWrite)
|
Dim fs As New FileStream(destFilePath, FileMode.Create, FileAccess.ReadWrite)
|
||||||
Await sRemote.CopyToAsync(fs)
|
Await sRemote.CopyToAsync(fs)
|
||||||
@@ -185,11 +186,13 @@ Public Class UpdateInstaller
|
|||||||
Case UpdateActionType.Copy
|
Case UpdateActionType.Copy
|
||||||
Dim srcFilePath As String = Path.Combine(localPath, action.SrcPath)
|
Dim srcFilePath As String = Path.Combine(localPath, action.SrcPath)
|
||||||
If File.Exists(srcFilePath) Then
|
If File.Exists(srcFilePath) Then
|
||||||
|
Directory.CreateDirectory(Path.GetDirectoryName(destFilePath))
|
||||||
File.Copy(srcFilePath, destFilePath, True)
|
File.Copy(srcFilePath, destFilePath, True)
|
||||||
End If
|
End If
|
||||||
Case UpdateActionType.Move
|
Case UpdateActionType.Move
|
||||||
Dim srcFilePath As String = Path.Combine(localPath, action.SrcPath)
|
Dim srcFilePath As String = Path.Combine(localPath, action.SrcPath)
|
||||||
If File.Exists(srcFilePath) Then
|
If File.Exists(srcFilePath) Then
|
||||||
|
Directory.CreateDirectory(Path.GetDirectoryName(destFilePath))
|
||||||
File.Move(srcFilePath, destFilePath, True)
|
File.Move(srcFilePath, destFilePath, True)
|
||||||
End If
|
End If
|
||||||
End Select
|
End Select
|
||||||
|
|||||||
Reference in New Issue
Block a user