From b74cc0d633bf843125881a722102426b2b044456 Mon Sep 17 00:00:00 2001 From: Pilzinsel64 Date: Fri, 5 May 2023 08:14:29 +0200 Subject: [PATCH] create dest directory if not exists --- ModpackUpdater/UpdateInstaller.vb | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ModpackUpdater/UpdateInstaller.vb b/ModpackUpdater/UpdateInstaller.vb index 99fd12d..dbfeb74 100644 --- a/ModpackUpdater/UpdateInstaller.vb +++ b/ModpackUpdater/UpdateInstaller.vb @@ -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