Removed debug logging, made GetExecutablePath more robust.

This commit is contained in:
Henry Asbridge 2024-01-17 23:30:16 +00:00
parent 36a17831e1
commit 71e24de72e
2 changed files with 5 additions and 5 deletions

View file

@ -35,15 +35,12 @@ public class ModeSelectionForm : Form {
// If we're on macOS then set the CWD to the app bundle MacOS folder, so that SCETool can be found.
if (OSUtil.GetPlatform() == OSPlatform.OSX) Directory.SetCurrentDirectory(OSUtil.GetExecutablePath());
if (!Directory.Exists("scetool"))
if (!Directory.Exists(OSUtil.GetExecutablePath()+"/scetool"))
{
// This will always occur on macOS, so don't show this message for macOS users.
if (OSUtil.GetPlatform() != OSPlatform.OSX) Gui.CreateOkDialog("Workaround Triggered", ".NET could not locate the required files, triggering workaround.");
Gui.CreateOkDialog("Workaround",
$"UnionPatcher RemotePatcher requires a staging folder on macOS or in special circumstances on Windows, please set this to the directory of the UnionPatcher app or executable! {EtoEnvironment.GetFolderPath(EtoSpecialFolder.ApplicationResources)}");
Gui.CreateOkDialog("Workaround", "UnionPatcher RemotePatcher requires a staging folder on macOS or in special circumstances on Windows, please set this to the directory of the UnionPatcher app or executable!");
SelectFolderDialog dialog = new SelectFolderDialog();
if (dialog.ShowDialog(this) != DialogResult.Ok)
{

View file

@ -38,6 +38,9 @@ namespace LBPUnion.UnionPatcher
var path = Path.GetDirectoryName(Assembly.GetEntryAssembly()?.Location);
if (string.IsNullOrEmpty(path))
path = Path.GetDirectoryName(Process.GetCurrentProcess().MainModule?.FileName);
if (string.IsNullOrEmpty(path))
path = AppContext.BaseDirectory;
return path;
}
}