mirror of
https://github.com/libretro/Mesen.git
synced 2024-12-15 21:37:56 +00:00
Command line: Fixed loading roms with relative path
This commit is contained in:
parent
6cee4544cb
commit
ed3ca11271
@ -72,10 +72,20 @@ namespace Mesen.GUI.Forms
|
||||
|
||||
if(args.Length > 0) {
|
||||
foreach(string arg in args) {
|
||||
if(File.Exists(arg)) {
|
||||
this.LoadFile(arg);
|
||||
break;
|
||||
}
|
||||
string path = arg;
|
||||
try {
|
||||
if(File.Exists(path)) {
|
||||
this.LoadFile(path);
|
||||
break;
|
||||
}
|
||||
|
||||
//Try loading file as a relative path to the folder Mesen was started from
|
||||
path = Path.Combine(Program.OriginalFolder, path);
|
||||
if(File.Exists(path)) {
|
||||
this.LoadFile(path);
|
||||
break;
|
||||
}
|
||||
} catch { }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -21,6 +21,7 @@ namespace Mesen.GUI
|
||||
private static extern bool SetForegroundWindow(IntPtr hWnd);
|
||||
|
||||
public static bool IsMono { get; private set; }
|
||||
public static string OriginalFolder { get; private set; }
|
||||
|
||||
private static void Application_ThreadException(object sender, ThreadExceptionEventArgs e)
|
||||
{
|
||||
@ -63,6 +64,8 @@ namespace Mesen.GUI
|
||||
if(Type.GetType("Mono.Runtime") != null) {
|
||||
Program.IsMono = true;
|
||||
}
|
||||
|
||||
Program.OriginalFolder = Directory.GetCurrentDirectory();
|
||||
|
||||
AppDomain.CurrentDomain.AssemblyResolve += LoadAssemblies;
|
||||
Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException);
|
||||
|
Loading…
Reference in New Issue
Block a user