diff --git a/Common.ruleset b/Common.ruleset index d661d1c0c1..8b7d3ee3d3 100644 --- a/Common.ruleset +++ b/Common.ruleset @@ -267,7 +267,7 @@ - + diff --git a/src/BizHawk.Client.Common/config/PathEntryCollectionExtensions.cs b/src/BizHawk.Client.Common/config/PathEntryCollectionExtensions.cs index f88b72d6e3..e8ed9d1a93 100644 --- a/src/BizHawk.Client.Common/config/PathEntryCollectionExtensions.cs +++ b/src/BizHawk.Client.Common/config/PathEntryCollectionExtensions.cs @@ -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"]; diff --git a/src/BizHawk.Common/Extensions/PathExtensions.cs b/src/BizHawk.Common/Extensions/PathExtensions.cs index e091a0cad3..6825d33733 100644 --- a/src/BizHawk.Common/Extensions/PathExtensions.cs +++ b/src/BizHawk.Common/Extensions/PathExtensions.cs @@ -169,6 +169,9 @@ namespace BizHawk.Common.PathExtensions /// returned string omits trailing slash 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);