a few QoL improvements

- fixed logging issues with custom save locations
- Linux should not have issues installing profiles anymore
- Launching games should not
- fixed an issue if for some reason a language is not found.
pull/6/head
Miepee 6 years ago
parent 4231edebad
commit 4777f34374

@ -611,7 +611,7 @@ namespace AM2RLauncher
{
// sets the arguments to empty, or to the profiles save path/logs and create time based logs. Creates the folder if necessary.
string arguments = "";
string savePath = profile.SaveLocation.Replace("%localappdata%", Environment.GetEnvironmentVariable("LOCALAPPDATA"));
string savePath = profile.SaveLocation.ToLower().Replace("%localappdata%", Environment.GetEnvironmentVariable("LOCALAPPDATA"));
string date = string.Join("-", DateTime.Now.ToString().Split(Path.GetInvalidFileNameChars(), StringSplitOptions.RemoveEmptyEntries));
// Game logging
@ -639,11 +639,16 @@ namespace AM2RLauncher
arguments = "-debugoutput \"" + savePath + "/logs/" + profile.Name + ".txt\" -output \"" + savePath + "/logs/" + profile.Name + ".txt\"";
}
Process proc = Process.Start(CrossPlatformOperations.CURRENTPATH + "/Profiles/" + profile.Name + "/AM2R.exe", arguments);
using (proc)
ProcessStartInfo proc = new ProcessStartInfo();
proc.WorkingDirectory = Environment.CurrentDirectory;
proc.FileName = CrossPlatformOperations.CURRENTPATH + "/Profiles/" + profile.Name + "/AM2R.exe";
proc.Arguments = arguments;
using (var p = Process.Start(proc))
{
SetForegroundWindow(proc.MainWindowHandle);
proc.WaitForExit();
SetForegroundWindow(p.MainWindowHandle);
p.WaitForExit();
}
}
else if (Platform.IsGtk)
@ -689,6 +694,7 @@ namespace AM2RLauncher
}
}
startInfo.WorkingDirectory = Environment.CurrentDirectory;
startInfo.UseShellExecute = false;
startInfo.FileName = CrossPlatformOperations.CURRENTPATH + "/Profiles/" + profile.Name + "/AM2R.AppImage";

@ -164,6 +164,8 @@ namespace AM2RLauncher
log.Info("Current Launcher Version: " + VERSION);
log.Info("Current Platform-ID is: " + Platform.ID);
// Set the Current Directory to the path the Launcher is located. Fixes some relative path issues.
Environment.CurrentDirectory = CrossPlatformOperations.CURRENTPATH;
//Set the language to what User wanted or choose local language
string userLanguage = CrossPlatformOperations.ReadFromConfig("Language").ToLower();
@ -544,8 +546,13 @@ namespace AM2RLauncher
languageDropDown.Items.AddRange(languageList);
var tmpLanguage = CrossPlatformOperations.ReadFromConfig("Language");
languageDropDown.SelectedIndex = tmpLanguage == "Default" ? 0 : languageDropDown.Items.IndexOf(languageDropDown.Items.Where(x => x.Text.Equals(tmpLanguage)).First());
languageDropDown.SelectedIndex = tmpLanguage == "Default" ? 0 : languageDropDown.Items.IndexOf(languageDropDown.Items.Where(x => x.Text.Equals(tmpLanguage)).FirstOrDefault());
if (languageDropDown.SelectedIndex == -1)
{
log.Info("User has tried to use " + tmpLanguage + " as a Language, but it was not found. Reverting to System Language");
languageDropDown.SelectedIndex = 0;
}
// autoUpdate checkbox
autoUpdateCheck = new CheckBox

Loading…
Cancel
Save