Skip to content

Commit

Permalink
Made the installer use a temp folder.
Browse files Browse the repository at this point in the history
  • Loading branch information
AsyncException committed Dec 30, 2023
1 parent 61a0e40 commit 915197b
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions Installer/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@
var config = new Config();
var httpClient = new HttpClient();

if (!Directory.Exists("Cache")) {
Directory.CreateDirectory("Cache");
string tempPath = Path.Combine(Path.GetTempPath(), "SplatoonLoadoutInstaller");
if (!Directory.Exists(tempPath)) {
Directory.CreateDirectory(tempPath);
}

await AnsiConsole.Status()
Expand Down Expand Up @@ -49,10 +50,18 @@ await AnsiConsole.Status()
}
catch (Exception ex) {
WriteErrorAndDie(ex);

}

}

//Remove Cache folder
try {
DirectoryInfo di = new DirectoryInfo(tempPath);
di.Delete(true);
}
catch (Exception ex) {
WriteErrorAndDie(ex);
}
async Task Download(StatusContext ctx)
{
try {
Expand Down Expand Up @@ -89,7 +98,7 @@ void Unpack(StatusContext ctx)
foreach (DirectoryInfo dir in di.GetDirectories()) { dir.Delete(true); }
}

ZipFile.ExtractToDirectory(config.GetCacheLocation(), programPath);
ZipFile.ExtractToDirectory(tempPath, programPath);
AnsiConsole.WriteLine("[LOG] Unpacked");
}
catch(Exception ex) {
Expand Down

0 comments on commit 915197b

Please sign in to comment.