Fix `%recent%` in Paths config
broken since introduction in 017743133
(pre-1.0 according to GitHub)
also enabled MA0052 "Replace constant Enum.ToString with nameof", which is what
tipped me off to this
This commit is contained in:
parent
0309cdc4bc
commit
41d46dd37d
|
@ -267,7 +267,7 @@
|
|||
<Rule Id="MA0051" Action="Hidden" />
|
||||
|
||||
<!-- Replace constant Enum.ToString with nameof -->
|
||||
<Rule Id="MA0052" Action="Hidden" />
|
||||
<Rule Id="MA0052" Action="Error" />
|
||||
|
||||
<!-- Make class sealed -->
|
||||
<Rule Id="MA0053" Action="Hidden" />
|
||||
|
|
|
@ -87,10 +87,7 @@ namespace BizHawk.Client.Common
|
|||
return collection.GlobalBaseAbsolutePath();
|
||||
}
|
||||
|
||||
if (path == "%recent%")
|
||||
{
|
||||
return Environment.SpecialFolder.Recent.ToString();
|
||||
}
|
||||
if (path == "%recent%") return PathUtils.SpecialRecentsDir;
|
||||
|
||||
if (path.StartsWith("%exe%"))
|
||||
{
|
||||
|
@ -202,10 +199,7 @@ namespace BizHawk.Client.Common
|
|||
return collection.AbsolutePathFor(collection[PathEntryCollection.GLOBAL, "ROM"].Path, PathEntryCollection.GLOBAL);
|
||||
}
|
||||
|
||||
if (collection.UseRecentForRoms)
|
||||
{
|
||||
return Environment.SpecialFolder.Recent.ToString();
|
||||
}
|
||||
if (collection.UseRecentForRoms) return PathUtils.SpecialRecentsDir;
|
||||
|
||||
var path = collection[systemId, "ROM"];
|
||||
|
||||
|
|
|
@ -169,6 +169,9 @@ namespace BizHawk.Common.PathExtensions
|
|||
/// <remarks>returned string omits trailing slash</remarks>
|
||||
public static readonly string ExeDirectoryPath;
|
||||
|
||||
public static string SpecialRecentsDir
|
||||
=> Environment.GetFolderPath(Environment.SpecialFolder.Recent, Environment.SpecialFolderOption.DoNotVerify);
|
||||
|
||||
static PathUtils()
|
||||
{
|
||||
var dirPath = Path.GetDirectoryName(Assembly.GetEntryAssembly()?.Location);
|
||||
|
|
Loading…
Reference in New Issue