mirror of
https://github.com/4sval/FModel.git
synced 2026-03-21 17:24:26 -05:00
NTE support + better directory permission detection
Some checks failed
FModel QA Builder / build (push) Has been cancelled
Some checks failed
FModel QA Builder / build (push) Has been cancelled
This commit is contained in:
parent
3edcd31450
commit
062d54e366
|
|
@ -1 +1 @@
|
|||
Subproject commit 87020fa42ab70bb44a08bcd9f5d742ad70c97373
|
||||
Subproject commit 0cd21c2d96068d29b812c9d0538de5654d8fbab5
|
||||
|
|
@ -51,13 +51,20 @@ public partial class App
|
|||
if (!Directory.Exists(UserSettings.Default.OutputDirectory))
|
||||
{
|
||||
var currentDir = Directory.GetCurrentDirectory();
|
||||
var dirInfo = new DirectoryInfo(currentDir);
|
||||
if (dirInfo.Attributes.HasFlag(FileAttributes.Archive))
|
||||
throw new Exception("FModel cannot be run from an archive file. Please extract it and try again.");
|
||||
if (dirInfo.Attributes.HasFlag(FileAttributes.ReadOnly))
|
||||
throw new Exception("FModel cannot be run from a read-only directory. Please move it to a writable location.");
|
||||
try
|
||||
{
|
||||
var outputDir = Directory.CreateDirectory(Path.Combine(currentDir, "Output"));
|
||||
using (File.Create(Path.Combine(outputDir.FullName, Path.GetRandomFileName()), 1, FileOptions.DeleteOnClose))
|
||||
{
|
||||
|
||||
UserSettings.Default.OutputDirectory = Path.Combine(currentDir, "Output");
|
||||
}
|
||||
|
||||
UserSettings.Default.OutputDirectory = outputDir.FullName;
|
||||
}
|
||||
catch (UnauthorizedAccessException exception)
|
||||
{
|
||||
throw new Exception("FModel cannot create the output directory where it is currently located. Please move FModel.exe to a different location.", exception);
|
||||
}
|
||||
}
|
||||
|
||||
if (!Directory.Exists(UserSettings.Default.RawDataDirectory))
|
||||
|
|
@ -126,15 +133,15 @@ public partial class App
|
|||
|
||||
var messageBox = new MessageBoxModel
|
||||
{
|
||||
Text = $"An unhandled exception occurred: {e.Exception.Message}",
|
||||
Text = $"An unhandled {e.Exception.GetBaseException().GetType()} occurred: {e.Exception.Message}",
|
||||
Caption = "Fatal Error",
|
||||
Icon = MessageBoxImage.Error,
|
||||
Buttons = new[]
|
||||
{
|
||||
Buttons =
|
||||
[
|
||||
MessageBoxButtons.Custom("Reset Settings", EErrorKind.ResetSettings),
|
||||
MessageBoxButtons.Custom("Restart", EErrorKind.Restart),
|
||||
MessageBoxButtons.Custom("OK", EErrorKind.Ignore)
|
||||
},
|
||||
],
|
||||
IsSoundEnabled = false
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user