Skip to content

Commit

Permalink
Fixed error with goto in async function
Browse files Browse the repository at this point in the history
  • Loading branch information
GoobyCorp committed Feb 4, 2024
1 parent b8bc4e5 commit 03fe27d
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ internal static class Program {
internal const string MODS_DIR = "Mods";
internal const string MODPACK_FILE = "modpack.zip";

static async Task Main(string[] args) {
static async Task<int> Main(string[] args) {
if(!File.Exists(CONFIG_FILE))
File.WriteAllText(CONFIG_FILE, "[]");

Expand All @@ -23,9 +23,8 @@ static async Task Main(string[] args) {
ConfigEntry[] entries = JsonSerializer.Deserialize<ConfigEntry[]>(File.ReadAllText(CONFIG_FILE));
if (entries == null || entries.Length == 0) {
Console.WriteLine("No config entries found, aborting...");
Console.WriteLine("Press ENTER to exit...");
Console.ReadKey();
return;
Finished();
return 0;
}

Console.WriteLine("Fetching download links and files...");
Expand All @@ -37,7 +36,11 @@ static async Task Main(string[] args) {
ZipFile.CreateFromDirectory(MODS_DIR, fs, CompressionLevel.Optimal, false);
Console.WriteLine("Done!");

// Finished:
Finished();
return 0;
}

internal static void Finished() {
#if DEBUG
Console.WriteLine("Press ENTER to exit...");
Console.ReadKey();
Expand Down

0 comments on commit 03fe27d

Please sign in to comment.