We have a user reporting that selecting one of the roots (e.g. “Music”) in FileBrowserComponent’s ComboBox sometimes makes the filelist show a wrong folder (e.g. the “Pictures” folder).
I’m guessing his issue is related to whether some network drive is mapped at the creation of the FileBrowserComponent. I have been able to reproduce it in the DemoRunner in the DialogsDemo. Steps to reproduce (on Windows 10):
- Click the “‘Load’ File Browser” button
- Click the down arrow symbol in the ComboBox and verify that at least one mapped network drive is shown
- Disconnect this network drive (in Windows Explorer right click network drive and choose “Disconnect”)
- Click “Music” in the ComboBox list
- The filelist in the FileBrowserComponent will now show the “Pictures” folder
The reason for this behavior is:
- The ComboBox is populated in the constructor of FileBrowserComponent (through call to resetRecentPaths() which calls getRoots() to get the roots to add)
- When clicking an entry in the ComboBox list, updateSelectedPath() makes a new call to getRoots() which will return another list of roots than the one shown in the ComboBox
- The entries in the ComboBox list and the list returned by getRoots() are thus out of sync
The best fix for this would probably be if FileBrowserComponent could automatically update the roots if any drives appear/disappear. An easier fix could be to make FileBrowserComponent use a cached version of the roots list in updateSelectedPath() to make sure the two lists are always identical.