UI: Fixed crash at startup if custom folders cannot be created
This commit is contained in:
parent
cd07736c9d
commit
86b0ab5064
3 changed files with 12 additions and 2 deletions
|
@ -201,8 +201,15 @@ namespace Mesen.GUI.Config
|
|||
} else {
|
||||
folder = defaultFolderName;
|
||||
}
|
||||
if(!Directory.Exists(folder)) {
|
||||
Directory.CreateDirectory(folder);
|
||||
|
||||
try {
|
||||
if(!Directory.Exists(folder)) {
|
||||
Directory.CreateDirectory(folder);
|
||||
}
|
||||
} catch {
|
||||
//If the folder doesn't exist and we couldn't create it, use the default folder
|
||||
InteropEmu.WriteLogEntry("[UI] Folder could not be created: " + folder);
|
||||
folder = defaultFolderName;
|
||||
}
|
||||
return folder;
|
||||
}
|
||||
|
|
|
@ -100,6 +100,7 @@ namespace Mesen.GUI
|
|||
|
||||
[DllImport(DLLPath)] public static extern void DisplayMessage([MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(UTF8Marshaler))]string title, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(UTF8Marshaler))]string message, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(UTF8Marshaler))]string param1 = null);
|
||||
[DllImport(DLLPath, EntryPoint = "GetLog")] private static extern IntPtr GetLogWrapper();
|
||||
[DllImport(DLLPath)] public static extern void WriteLogEntry([MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(UTF8Marshaler))]string message);
|
||||
|
||||
[DllImport(DLLPath)] public static extern void MoviePlay([MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(UTF8Marshaler))]string filename);
|
||||
[DllImport(DLLPath)] public static extern void MovieRecord(ref RecordMovieOptions options);
|
||||
|
|
|
@ -423,6 +423,8 @@ namespace InteropEmu {
|
|||
return _logString.c_str();
|
||||
}
|
||||
|
||||
DllExport void __stdcall WriteLogEntry(char* message) { MessageManager::Log(message); }
|
||||
|
||||
DllExport void __stdcall SaveState(uint32_t stateIndex) { _console->GetSaveStateManager()->SaveState(stateIndex); }
|
||||
DllExport void __stdcall LoadState(uint32_t stateIndex) { _console->GetSaveStateManager()->LoadState(stateIndex); }
|
||||
DllExport void __stdcall SaveStateFile(char* filepath) { _console->GetSaveStateManager()->SaveState(filepath); }
|
||||
|
|
Loading…
Add table
Reference in a new issue