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 25a1182..5df6d4e 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. /// @@ -499,7 +499,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 26b2b5f..12e853c 100644 --- a/AM2RLauncher/AM2RLauncher/MainForm/MainForm.StateMachine.cs +++ b/AM2RLauncher/AM2RLauncher/MainForm/MainForm.StateMachine.cs @@ -194,7 +194,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); diff --git a/README.md b/README.md index 921f03e..fed4d2a 100644 --- a/README.md +++ b/README.md @@ -36,8 +36,9 @@ Alternatively, for Arch Linux users an [AUR Package](https://aur.archlinux.org/p ## Configuration and Data Files The AM2RLauncher stores its files in the following places: - - On Windows, it stores the config file to the `AM2RLauncher.exe.config` next to the binary, and its data files in the same folder as the binary. - - On Linux, it stores the config file to `$XDG_CONFIG_HOME/AM2RLauncher` and its data files to `$XDG_DATA_HOME/AM2RLauncher` (which are defaulting back to `~/.config` and `~/.local/share` respectively). +- On Windows, it stores the config file to the `AM2RLauncher.exe.config` next to the binary, and its data files in the same folder as the binary. +- On Linux, it stores the config file to `$XDG_CONFIG_HOME/AM2RLauncher` and its data files to `$XDG_DATA_HOME/AM2RLauncher` (which are defaulting back to `~/.config` and `~/.local/share` respectively). + The AM2RLauncher data can get quite big, so if you wish to change where it stores it, you can do so with the `AM2RLAUNCHERDATA` environment variable (i.e `AM2RLAUNCHERDATA="D:\MyLauncherData"` or `AM2RLAUNCHERDATA="/mnt/bigDrive/launcherData"`). # Compiling Instructions: @@ -49,5 +50,5 @@ Open the solution with Visual Studio 2019. Alternatively, build via `dotnet build` / the `buildAll` batch file. ## Linux Instructions -In order to build for linux, use `dotnet publish AM2RLauncher.Gtk -p:PublishSingleFile=true -c release -r ubuntu.18.04-x64`, MonoDevelop sadly doesn't work. +In order to build for linux, use `dotnet publish AM2RLauncher.Gtk -p:PublishSingleFile=true -p:DebugType=embedded -c release -r ubuntu.18.04-x64 --no-self-contained`, MonoDevelop sadly doesn't work. You *have* to specify it to build for Ubuntu, even on non-Ubuntu distros, because one of our Dependencies, libgit2sharp fails on the `linux-x64` RID.