mirror of
https://github.com/fadden/6502bench.git
synced 2024-11-27 12:50:06 +00:00
Improve chances of running under Mono
Updated the RuntimeData directory finder to work, and made the stuff that crashed when the directory wasn't found crash in less obvious ways. Under Mono+Linux it still falls over with some complaints about ListViews. This will need some work.
This commit is contained in:
parent
11174b8e75
commit
60aa252352
@ -200,15 +200,21 @@ namespace SourceGen.AppForms {
|
|||||||
Properties.Resources.RUNTIME_DIR_NOT_FOUND_CAPTION,
|
Properties.Resources.RUNTIME_DIR_NOT_FOUND_CAPTION,
|
||||||
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
Application.Exit();
|
Application.Exit();
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
PluginDllCache.PreparePluginDir();
|
PluginDllCache.PreparePluginDir();
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
|
string pluginPath = PluginDllCache.GetPluginDirPath();
|
||||||
|
if (pluginPath == null) {
|
||||||
|
pluginPath = "<???>";
|
||||||
|
}
|
||||||
string msg = string.Format(Properties.Resources.PLUGIN_DIR_FAIL,
|
string msg = string.Format(Properties.Resources.PLUGIN_DIR_FAIL,
|
||||||
PluginDllCache.GetPluginDirPath() + ": " + ex.Message);
|
pluginPath + ": " + ex.Message);
|
||||||
MessageBox.Show(msg, Properties.Resources.PLUGIN_DIR_FAIL_CAPTION,
|
MessageBox.Show(msg, Properties.Resources.PLUGIN_DIR_FAIL_CAPTION,
|
||||||
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
Application.Exit();
|
Application.Exit();
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
logoPictureBox.ImageLocation = RuntimeDataAccess.GetPathName(LOGO_FILE_NAME);
|
logoPictureBox.ImageLocation = RuntimeDataAccess.GetPathName(LOGO_FILE_NAME);
|
||||||
|
@ -38,7 +38,10 @@ namespace SourceGen {
|
|||||||
return sBasePath;
|
return sBasePath;
|
||||||
}
|
}
|
||||||
|
|
||||||
string exeName = Process.GetCurrentProcess().MainModule.FileName;
|
// Process.GetCurrentProcess().MainModule.FileName returns "/usr/bin/mono-sgen"
|
||||||
|
// under Linux, which is not what we want. Since this class is part of the main
|
||||||
|
// executable, we can use our own assembly location to get the desired answer.
|
||||||
|
string exeName = typeof(RuntimeDataAccess).Assembly.Location;
|
||||||
string baseDir = Path.GetDirectoryName(exeName);
|
string baseDir = Path.GetDirectoryName(exeName);
|
||||||
if (string.IsNullOrEmpty(baseDir)) {
|
if (string.IsNullOrEmpty(baseDir)) {
|
||||||
return null;
|
return null;
|
||||||
|
@ -63,10 +63,14 @@ namespace SourceGen.Sandbox {
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Computes the path to the plugin directory. Does not attempt to verify that it exists.
|
/// Computes the path to the plugin directory. Does not attempt to verify that it exists.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns>Plugin directory path.</returns>
|
/// <returns>Plugin directory path, or null if we can't find the application data
|
||||||
|
/// area.</returns>
|
||||||
public static string GetPluginDirPath() {
|
public static string GetPluginDirPath() {
|
||||||
if (sPluginDirPath == null) {
|
if (sPluginDirPath == null) {
|
||||||
string runtimeUp = Path.GetDirectoryName(RuntimeDataAccess.GetDirectory());
|
string runtimeUp = Path.GetDirectoryName(RuntimeDataAccess.GetDirectory());
|
||||||
|
if (runtimeUp == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
sPluginDirPath = Path.Combine(runtimeUp, PLUGIN_DIR_NAME);
|
sPluginDirPath = Path.Combine(runtimeUp, PLUGIN_DIR_NAME);
|
||||||
}
|
}
|
||||||
return sPluginDirPath;
|
return sPluginDirPath;
|
||||||
|
Loading…
Reference in New Issue
Block a user