Make Linux not crash on boot, add todos + small cleanup

pull/30/head
Miepee 5 years ago
parent 05a7739b40
commit c0261fd05c

3
.gitignore vendored

@ -349,3 +349,6 @@ MigrationBackup/
# Ionide (cross platform F# VS Code tools) working folder
.ionide/
# Visual Studio Code folder
.vscode/

@ -46,6 +46,7 @@ namespace AM2RLauncher.Gtk
{
log.Error("An unhandled exception has occurred: \n*****Stack Trace*****\n\n" + e.StackTrace.ToString());
Console.WriteLine(Language.Text.UnhandledException + "\n" + e.Message + "\n*****Stack Trace*****\n\n" + e.StackTrace.ToString());
Console.WriteLine("Check the logs at " + launcherDataPath + " for more info!");
}
}
@ -95,7 +96,7 @@ namespace AM2RLauncher.Gtk
}
catch { }
return Path.GetDirectoryName(Assembly.GetEntryAssembly().Location);
return Path.GetDirectoryName(AppDomain.CurrentDomain.BaseDirectory);
}
}
}

@ -25,11 +25,6 @@ namespace AM2RLauncher
/// </summary>
private static readonly Platform currentPlatform = Platform.Instance;
/// <summary>
/// Current Path where the Launcher is located. For more info, check <see cref="GenerateCurrentPath"/>.
/// </summary>
public static readonly string CURRENTPATH = GenerateCurrentPath();
/// <summary>
/// Name of the Launcher executable.
/// </summary>
@ -45,6 +40,11 @@ namespace AM2RLauncher
/// </summary>
public static readonly string NIXXDGCONFIG = Environment.GetEnvironmentVariable("XDG_CONFIG_HOME");
/// <summary>
/// Current Path where the Launcher is located. For more info, check <see cref="GenerateCurrentPath"/>.
/// </summary>
public static readonly string CURRENTPATH = GenerateCurrentPath();
/// <summary>
/// Generates the mirror list, depending on the current Platform.
/// </summary>
@ -464,7 +464,7 @@ namespace AM2RLauncher
}
log.Info("Something went wrong, falling back to the default CurrentPath.");
return Path.GetDirectoryName(Assembly.GetEntryAssembly().Location);
return Path.GetDirectoryName(AppDomain.CurrentDomain.BaseDirectory);
}
}
}

@ -746,7 +746,7 @@ namespace AM2RLauncher
profileAuthorLabel.Text = Language.Text.Author + " " + profileList[profileDropDown.SelectedIndex].Author;
profileVersionLabel.Text = Language.Text.VersionLabel + " " + profileList[profileDropDown.SelectedIndex].Version;
CrossPlatformOperations.WriteToConfig("ProfileIndex", profileIndex + ""); // Loj, tell me a better way to do this
CrossPlatformOperations.WriteToConfig("ProfileIndex", profileIndex.ToString());
if (profileDropDown.SelectedIndex != 0 && (profileList[profileDropDown.SelectedIndex].SaveLocation == "%localappdata%/AM2R" ||
profileList[profileDropDown.SelectedIndex].SaveLocation == "default"))
@ -754,7 +754,6 @@ namespace AM2RLauncher
else
saveWarningLabel.Visible = false;
UpdateStateMachine();
Console.WriteLine("end profile drop down changed");
}
/// <summary>Gets called when user selects a different item from <see cref="languageDropDown"/> and writes that to the config.</summary>

@ -212,7 +212,6 @@ namespace AM2RLauncher
if (enabled)
{
settingsProfileDropDown.SelectedIndex = profileDropDown.SelectedIndex;
SettingsProfileDropDownSelectedIndexChanged(null, null);
}
}
}

@ -140,7 +140,8 @@ namespace AM2RLauncher
log.Info("Set Launcher CWD to " + Environment.CurrentDirectory);
// But log actual folder location nonetheless
log.Info("Actual Launcher location: " + Path.GetDirectoryName(System.Reflection.Assembly.GetEntryAssembly().Location));
// TODO: test if this logs correctly on windows now
log.Info("Actual Launcher location: " + Path.GetDirectoryName(AppDomain.CurrentDomain.BaseDirectory));
// Set the language to what User wanted or choose local language
string userLanguage = CrossPlatformOperations.ReadFromConfig("Language").ToLower();
@ -211,6 +212,7 @@ namespace AM2RLauncher
Icon = new Icon(1f, am2rIcon);
Title = "AM2RLauncher " + VERSION + ": " + splash;
MinimumSize = new Size(500, 400);
// TODO: for some reason, this sometimes doesn't work on Linux. Eto bug maybe?
ClientSize = new Size(int.Parse(CrossPlatformOperations.ReadFromConfig("Width")), int.Parse(CrossPlatformOperations.ReadFromConfig("Height")));
if (ClientSize.Width < 500)
ClientSize = new Size(500, ClientSize.Height);

Loading…
Cancel
Save