Unable to display content of C: and (non network) drives using juce::FileBrowserComponent

I’ve noticed that the juce::FileBrowserComponent is unable to list the content of the C: and other physical drives (network drives seems to work ok), as juce::File(“C:”) is not recognized as directory:

I think the check should be something like:

if (root.isDirectory() || root.isRoot())

This seems to fix my issue, any chance to have this addressed ?

To test this, I tried adding these lines to the constructor of DemoTabbedComponent in the WidgetsDemo:

addTab ("Files",
        new FileBrowserComponent (FileBrowserComponent::openMode | FileBrowserComponent::canSelectFiles,
                                  File { "C:" },

When I open the WidgetsDemo and select the “Files” tab, the contents of my “C:” drive are shown, and I can navigate around as normal. If I step into the constructor, it seems that File { "C:" }.isDirectory() returns true on my system.

I’m building with JUCE develop, on Windows 10 20H2.

Does my test case differ from your use case?

Try to navigate from a folder other than C: back to the root. It failed for me from a virtualised and non virtualised win10

I can click into folders in my C: drive, and then hit the ‘up’ button to go back to the root with no problems. I can also use the dropdown menu to switch between C and D drives, again without issues.

If you stick a breakpoint in File::isDirectory() in juce_win32_Files.cpp, what file attributes are reported for your root directories?

I understand now what it is, because i need to use long paths, i have enabled the \\?\ UNC paths, so \\?\C: is actually reported as a volume, not a directory.

Will this be solved officially somewhen? Long path names in windows breaks juce API in multiple places

I think @ed95’s previous answer still holds. It’s on the backlog, but we’re occupied with work in other areas at the moment.

1 Like