Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

quark-zju
Copy link
Collaborator

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.

Previously, this function scans all subdirectory files recursively.
It's hitting "permissoin denied" errors for random files, on my machine.

Change it to only look at the top-level directories.

This should also improve performance significantly.
@zumoshi
Copy link
Owner

zumoshi commented Feb 3, 2024

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
Copy link
Collaborator Author

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
Copy link
Owner

zumoshi commented Feb 3, 2024

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 ...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants