From 59258367367ee9103a2c38abf761e0071261bc9d Mon Sep 17 00:00:00 2001 From: Pilzinsel64 Date: Fri, 5 May 2023 14:26:55 +0200 Subject: [PATCH] add IsDirectory and support Delete actions --- ModpackUpdater/UpdateAction.vb | 1 + ModpackUpdater/UpdateInstaller.vb | 10 ++++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/ModpackUpdater/UpdateAction.vb b/ModpackUpdater/UpdateAction.vb index 4c53808..a5cb520 100644 --- a/ModpackUpdater/UpdateAction.vb +++ b/ModpackUpdater/UpdateAction.vb @@ -8,5 +8,6 @@ Public Class UpdateAction Public Property DestPath As String Public Property SrcPath As String Public Property DownloadUrl As String + Public Property IsDirectory As Boolean End Class diff --git a/ModpackUpdater/UpdateInstaller.vb b/ModpackUpdater/UpdateInstaller.vb index dbfeb74..8a6e423 100644 --- a/ModpackUpdater/UpdateInstaller.vb +++ b/ModpackUpdater/UpdateInstaller.vb @@ -180,8 +180,14 @@ Public Class UpdateInstaller sRemote.Close() fs.Close() Case UpdateActionType.Delete - If File.Exists(destFilePath) Then - File.Delete(destFilePath) + If action.IsDirectory Then + If Directory.Exists(destFilePath) Then + Directory.Delete(destFilePath, True) + End If + Else + If File.Exists(destFilePath) Then + File.Delete(destFilePath) + End If End If Case UpdateActionType.Copy Dim srcFilePath As String = Path.Combine(localPath, action.SrcPath)