From ec1cf7c94796b6d8fa46ebc0b161732411fb0c2b Mon Sep 17 00:00:00 2001 From: Seyyed Soroosh Hosseinalipour Date: Mon, 11 Jul 2022 01:24:10 +0430 Subject: [PATCH] Correct searching config base on exe file name. --- .../UWPAppConfigPathExtractor.cs | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/Lib/PCLAppConfig.FileSystemStream.UWP/UWPAppConfigPathExtractor.cs b/src/Lib/PCLAppConfig.FileSystemStream.UWP/UWPAppConfigPathExtractor.cs index 25716d7..3d5e27a 100644 --- a/src/Lib/PCLAppConfig.FileSystemStream.UWP/UWPAppConfigPathExtractor.cs +++ b/src/Lib/PCLAppConfig.FileSystemStream.UWP/UWPAppConfigPathExtractor.cs @@ -15,15 +15,20 @@ public string Path get { string rootPath = Package.Current.InstalledLocation.Path; - string exeConfig = System.IO.Path.Combine(rootPath, Package.Current.DisplayName + ".exe.config"); - if (!File.Exists(exeConfig)) + string packageConfig = System.IO.Path.Combine(rootPath, Package.Current.DisplayName + ".exe.config"); + string exeConfig = System.IO.Path.Combine(rootPath, System.AppDomain.CurrentDomain.FriendlyName + ".exe.config"); + if (File.Exists(packageConfig)) { - return System.IO.Path.Combine(rootPath, "App.config"); + return packageConfig; } - else + else if (File.Exists(exeConfig)) { return exeConfig; } + else + { + return System.IO.Path.Combine(rootPath, "App.config"); + } } } }