Skip to content

Commit

Permalink
Fixed zip downloading
Browse files Browse the repository at this point in the history
  • Loading branch information
evilfactory committed Aug 30, 2024
1 parent 3f3e37b commit c907a01
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
11 changes: 9 additions & 2 deletions Luatrauma.AutoUpdater/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,15 @@ public async static Task Start()
if (Args.Length > 0)
{
Console.WriteLine("Starting " + string.Join(" ", Args));
Process process = Process.Start(Args[0], Args.Skip(1).ToArray());
await process.WaitForExitAsync();

var info = new ProcessStartInfo
{
FileName = Args[0],
Arguments = string.Join(" ", Args.Skip(1)),
WorkingDirectory = Path.GetDirectoryName(Args[0]),
};

Process.Start(info);
}
}
}
Expand Down
7 changes: 4 additions & 3 deletions Luatrauma.AutoUpdater/Updater.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,10 @@ public async static Task Update()
try
{
using var client = new HttpClient();
using var s = await client.GetStreamAsync(patchUrl);
using var fs = new FileStream(patchZip, FileMode.OpenOrCreate);
await s.CopyToAsync(fs);

byte[] fileBytes = await client.GetByteArrayAsync(patchUrl);

await File.WriteAllBytesAsync(patchZip, fileBytes);
}
catch (Exception e)
{
Expand Down

0 comments on commit c907a01

Please sign in to comment.