Skip to content

Commit

Permalink
Cleanup Zip and Extracted folder in AppData after installation.
Browse files Browse the repository at this point in the history
  • Loading branch information
Soapwood committed Jul 9, 2024
1 parent d716333 commit ea577ab
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 8 deletions.
24 changes: 20 additions & 4 deletions VXAutoUpdater/Core/VXMusicAutoUpdater.cs
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,7 @@ public static async Task UpdateApplicationBasedOnRequestedVersion(string branch,
string targetPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles), "VXMusic");

_autoUpdater.ExtractAndReplace(_autoUpdater.UpdateZipPath, extractPath, targetPath);

// TODO Cleanup zips after installation
// Handle extraction and installation of the update as per your application's needs


UpdateMessageInMainWindow($"Installation of [{branch}] ({release.Name}) was Successful!");
}
else
Expand Down Expand Up @@ -217,6 +214,25 @@ public void ExtractAndReplace(string zipPath, string extractPath, string targetP
{
Console.WriteLine($"An error occured: {e}");
}

try
{
UpdateMessageInMainWindow("Deleting downloaded zip...");
if(File.Exists(zipPath))
File.Delete(zipPath);

UpdateMessageInMainWindow("Deleting extracted zip folder...");
if (Directory.Exists(extractPath))
Directory.Delete(extractPath, true);
}
catch (UnauthorizedAccessException uae)
{
Console.WriteLine("User does not have the required privileges, please run as Administrator");
}
catch (Exception e)
{
Console.WriteLine($"An error occured: {e}");
}
}

private void ReplaceDirectoryContents(string sourceDir, string targetDir)
Expand Down
2 changes: 1 addition & 1 deletion VXAutoUpdater/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ private void MinimizeButton_Click(object sender, RoutedEventArgs e)

private void CloseButton_Click(object sender, RoutedEventArgs e)
{
this.Close(); // TODO Close down services gracfully
this.Close();
}

private void LaunchUpdatedVXMusicDesktop()
Expand Down
2 changes: 1 addition & 1 deletion VXMusicDesktop/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ private void MinimizeButton_Click(object sender, RoutedEventArgs e)

private void CloseButton_Click(object sender, RoutedEventArgs e)
{
this.Close(); // TODO Close down services gracfully
this.Close();
}

private void ThemeDropdownSelection(object sender, SelectionChangedEventArgs e)
Expand Down
2 changes: 1 addition & 1 deletion VXMusicDesktop/Overlay/VXMusicOverlayInterface.cs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public static Process LaunchVXMOverlayRuntime(string runtimePath)
Arguments = "",
UseShellExecute = false, // Set this to false to redirect output if needed
CreateNoWindow = true, // Set this to true to hide the Unity window
Verb = "runas", // TODO does this need to be here?
Verb = "runas",
WindowStyle = ProcessWindowStyle.Minimized
};

Expand Down
2 changes: 1 addition & 1 deletion VXMusicDesktop/VXMusicDesktop.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<PackageIcon>VXLogo.png</PackageIcon>
<ApplicationIcon>Images\VXLogoIcon.ico</ApplicationIcon>
<RunPostBuildEvent>Always</RunPostBuildEvent>
<Version>0.6.3.1</Version>
<Version>0.6.3.2</Version>
<SatelliteResourceLanguages>en</SatelliteResourceLanguages>
</PropertyGroup>

Expand Down

0 comments on commit ea577ab

Please sign in to comment.