zumoshi / BrowserSelect

Browser Select is a utility to dynamically select the browser you want instead of just having one default for all links.
GNU General Public License v2.0
289 stars 39 forks source link

Improve perf and fix permission denied errors with latest Chrome releases #96

Open quark-zju opened 7 months ago

quark-zju commented 7 months ago

The latest Chrome release includes some features that disallows programs to read certain files, like:

System.UnauthorizedAccessException: Access to the path 'C:\Users\quark\AppData\Local\Google\Chrome\User Data\OnDeviceHeadSuggestModel\20231010.253971461.12' is denied.
   at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
   at System.IO.FileSystemEnumerableIterator`1.AddSearchableDirsToStack(SearchData localSearchData)
   at System.IO.FileSystemEnumerableIterator`1.MoveNext()
   at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
   at System.IO.Directory.GetFiles(String path, String searchPattern, SearchOption searchOption)
   at BrowserSelect.BrowserFinder.FindChromeProfiles(String ChromeUserDataDir)
   at BrowserSelect.BrowserFinder.find(Boolean update)
   at BrowserSelect.Form1.updateBrowsers()
   at BrowserSelect.Form1.Form1_Load(Object sender, EventArgs e)
   at System.Windows.Forms.Form.OnLoad(EventArgs e)
   at System.Windows.Forms.Form.OnCreateControl()
   at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
   at System.Windows.Forms.Control.CreateControl()
   at System.Windows.Forms.Control.WmShowWindow(Message& m)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.Form.WmShowWindow(Message& m)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

Fix it by only visiting top-level directories to detect profiles. This should also improve performance.

zumoshi commented 7 months ago

Looks good 👍🏼

Unfortunately, I don't have access to VS atm to be able to make a release. part of why the project is semi-abandoned is because I don't use it personally anymore since I switched to linux.

Interested in becoming a maintainer and reviewing/merging other PRs and looking through issues? or is that kind of time commitment not feasible for you?

I also made the offer to lucasnz who had made some improvements to the project before but got no response.

quark-zju commented 7 months ago

Interested in becoming a maintainer and reviewing/merging other PRs and looking through issues? or is that kind of time commitment not feasible for you?

Hi, I think I can do some lightweight maintenance to keep this project working while I use it. That said, I'm not super familiar with .net/C# so I probably will skip looking through most issues. I can take a look at the current PRs, though.

zumoshi commented 7 months ago

Good to hear. sent an invite. Feel free to accept your own pr and make a release after bumping the version and creating a setup executable.

I don't have github actions set up for it so unless you're up for setting that up you need to run nsis manually after you compiled it and upload after testing it.

I'll do my best to answer any questions you had about the codebase as long as I remember, it has been a while since I last worked on this ...