Skip to content

Commit

Permalink
Fix ConfigurationManager when BaseDirectory starts with \\?" (dotnet#…
Browse files Browse the repository at this point in the history
  • Loading branch information
krwq authored Sep 6, 2021
1 parent 7d54e21 commit b7e1037
Showing 1 changed file with 1 addition and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -64,17 +64,7 @@ private ClientConfigPaths(string exePath, bool includeUserConfig)
if (exeAssembly != null && !isSingleFile)
{
HasEntryAssembly = true;

// The original .NET Framework code tried to get the local path without using Uri.
// If we ever find a need to do this again be careful with the logic. "file:///" is
// used for local paths and "file://" for UNCs. Simply removing the prefix will make
// local paths relative on Unix (e.g. "file:///home" will become "home" instead of
// "/home").
string configBasePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, exeAssembly.ManifestModule.Name);
Uri uri = new Uri(configBasePath);

Debug.Assert(uri.IsFile);
ApplicationUri = uri.LocalPath;
ApplicationUri = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, exeAssembly.ManifestModule.Name);
}
else
{
Expand Down

0 comments on commit b7e1037

Please sign in to comment.