diff --git a/.gitignore b/.gitignore index 3614817..fb2c22e 100644 --- a/.gitignore +++ b/.gitignore @@ -349,3 +349,6 @@ MigrationBackup/ # Ionide (cross platform F# VS Code tools) working folder .ionide/ + +# Visual Studio Code folder +.vscode/ diff --git a/AM2RLauncher/AM2RLauncher.Gtk/Program.cs b/AM2RLauncher/AM2RLauncher.Gtk/Program.cs index 2d36bb3..c3652c7 100644 --- a/AM2RLauncher/AM2RLauncher.Gtk/Program.cs +++ b/AM2RLauncher/AM2RLauncher.Gtk/Program.cs @@ -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); } } } diff --git a/AM2RLauncher/AM2RLauncher/CrossPlatformOperations.cs b/AM2RLauncher/AM2RLauncher/CrossPlatformOperations.cs index 35e5a1b..a6ccc7d 100644 --- a/AM2RLauncher/AM2RLauncher/CrossPlatformOperations.cs +++ b/AM2RLauncher/AM2RLauncher/CrossPlatformOperations.cs @@ -25,11 +25,6 @@ namespace AM2RLauncher /// private static readonly Platform currentPlatform = Platform.Instance; - /// - /// Current Path where the Launcher is located. For more info, check . - /// - public static readonly string CURRENTPATH = GenerateCurrentPath(); - /// /// Name of the Launcher executable. /// @@ -45,6 +40,11 @@ namespace AM2RLauncher /// public static readonly string NIXXDGCONFIG = Environment.GetEnvironmentVariable("XDG_CONFIG_HOME"); + /// + /// Current Path where the Launcher is located. For more info, check . + /// + public static readonly string CURRENTPATH = GenerateCurrentPath(); + /// /// Generates the mirror list, depending on the current Platform. /// @@ -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); } } } diff --git a/AM2RLauncher/AM2RLauncher/MainForm/MainForm.Events.cs b/AM2RLauncher/AM2RLauncher/MainForm/MainForm.Events.cs index 7a20913..61ac52a 100644 --- a/AM2RLauncher/AM2RLauncher/MainForm/MainForm.Events.cs +++ b/AM2RLauncher/AM2RLauncher/MainForm/MainForm.Events.cs @@ -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"); } /// Gets called when user selects a different item from and writes that to the config. diff --git a/AM2RLauncher/AM2RLauncher/MainForm/MainForm.StateMachine.cs b/AM2RLauncher/AM2RLauncher/MainForm/MainForm.StateMachine.cs index c4cd763..975835c 100644 --- a/AM2RLauncher/AM2RLauncher/MainForm/MainForm.StateMachine.cs +++ b/AM2RLauncher/AM2RLauncher/MainForm/MainForm.StateMachine.cs @@ -212,7 +212,6 @@ namespace AM2RLauncher if (enabled) { settingsProfileDropDown.SelectedIndex = profileDropDown.SelectedIndex; - SettingsProfileDropDownSelectedIndexChanged(null, null); } } } diff --git a/AM2RLauncher/AM2RLauncher/MainForm/MainForm.UI.cs b/AM2RLauncher/AM2RLauncher/MainForm/MainForm.UI.cs index cafe4a3..dc9de28 100644 --- a/AM2RLauncher/AM2RLauncher/MainForm/MainForm.UI.cs +++ b/AM2RLauncher/AM2RLauncher/MainForm/MainForm.UI.cs @@ -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);