fix: CTD when paths are edited

This commit is contained in:
Timothy Baldridge 2022-08-22 10:28:11 -06:00
parent 9f1f2c009a
commit 5cfa111f7c
3 changed files with 19 additions and 2 deletions

View File

@ -1,5 +1,10 @@
### Changelog ### Changelog
#### Version - 3.0.0.5 -
* No longer rehashes files on every compile
* Editing paths in the install/compile settings won't crash the app
* Fix for .refcache files not being ignored during compilation
#### Version - 3.0.0.4 - 8/20/2022 #### Version - 3.0.0.4 - 8/20/2022
* Fix for: when some optional game files weren't present (like CreationKit.exe), the app would refuse to recognize any files from that game * Fix for: when some optional game files weren't present (like CreationKit.exe), the app would refuse to recognize any files from that game

View File

@ -74,7 +74,7 @@ namespace Wabbajack
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{ {
return (AbsolutePath)(value as string); return AbsolutePath.ConvertNoFailure((string) value);
} }
} }
} }

View File

@ -47,7 +47,7 @@ public struct AbsolutePath : IPath, IComparable<AbsolutePath>, IEquatable<Absolu
if (path.StartsWith(@"\\")) if (path.StartsWith(@"\\"))
return PathFormat.Windows; return PathFormat.Windows;
if (DriveLetters.Contains(path[0]) && path[1] == ':') if (path.Length >= 2 && DriveLetters.Contains(path[0]) && path[1] == ':')
return PathFormat.Windows; return PathFormat.Windows;
throw new PathException($"Invalid Path format: {path}"); throw new PathException($"Invalid Path format: {path}");
@ -192,4 +192,16 @@ public struct AbsolutePath : IPath, IComparable<AbsolutePath>, IEquatable<Absolu
return Parent.Combine((FileName.WithoutExtension() + append).ToRelativePath() return Parent.Combine((FileName.WithoutExtension() + append).ToRelativePath()
.WithExtension(Extension)); .WithExtension(Extension));
} }
public static AbsolutePath ConvertNoFailure(string value)
{
try
{
return (AbsolutePath) value;
}
catch (Exception ex)
{
return default;
}
}
} }