diff --git a/BrowserSelect/Browser.cs b/BrowserSelect/Browser.cs index f6dc422..0ca6749 100644 --- a/BrowserSelect/Browser.cs +++ b/BrowserSelect/Browser.cs @@ -177,10 +177,11 @@ private static string GetChromeProfileName(string FullProfilePath) private static List FindChromeProfiles(string ChromeUserDataDir, string IconFilename) { List Profiles = new List(); - var ProfileDirs = Directory.GetFiles(ChromeUserDataDir, IconFilename, SearchOption.AllDirectories).Select(Path.GetDirectoryName); - foreach (var Profile in ProfileDirs) + var TopLevelDirs = Directory.GetDirectories(ChromeUserDataDir); + foreach (var Dir in TopLevelDirs) { - Profiles.Add(Profile.Substring(ChromeUserDataDir.Length + 1)); + var BaseName = Dir.Substring(ChromeUserDataDir.Length + 1); + if (File.Exists(Dir + "\\" + IconFilename)) { Profiles.Add(BaseName); } } return Profiles; } diff --git a/BrowserSelect/ForegroundAgent.cs b/BrowserSelect/ForegroundAgent.cs index 90c69d7..dc5357d 100644 --- a/BrowserSelect/ForegroundAgent.cs +++ b/BrowserSelect/ForegroundAgent.cs @@ -34,7 +34,7 @@ class ForegroundAgent /// also gives said window focus (setForegroundWindow) /// /// hWnd of window to be restored - public static void RestoreWindow(int hwnd) + public static void RestoreWindow(long hwnd) { var hWnd = new IntPtr(hwnd);