FileChooser::getResult() returns invalid File when choosing a file from a network location

Hi,

I’m having some trouble on Windows 7 when using native FileChooser::browseForFileToOpen() and choosing a file from a network location. If I choose a file from a NAS by first typing the its IP (e.g. \\10.1.12.40) into the URL field (not sure this is the right name - I mean the top edit/combo box on a native open dialog) and then navigating to a file, FileChooser::getResult() returns a file with an invalid path.

As an example, if I choose a file at "\\10.1.12.40\somewhere\file.txt", FileChooser::getResult() returns a file with the path "C:\current\working\dir\10.1.12.40\somewhere\file.txt".

This can be reproduced in the CodeEditorDemo in the DemoRunner.

The problem was brought to my attention by a user on Windows 10, so it’s not just a Windows 7 problem.

Here’s what I found out:

In URL::fileFromFileSchemeURL(const URL& fileURL), fileURL is "file:///10.1.12.40/somewhere/file.txt" but the constructed path is "10.1.12.40\\somewhere\\file.txt". The thing to note here is that the String is not prefixed with two backslashes (or four if we count the needed escaping backslashes).

This causes File::parseAbsolutePath() to prefix the file path with the current working directory (after an assert because it sees a non-absolute path).

This was fixed on develop a few moments ago:

Good news!