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

[Windows] Unable to select drive in project manager import dialog #96279

Closed
and-rad opened this issue Aug 29, 2024 · 1 comment · Fixed by #96283
Closed

[Windows] Unable to select drive in project manager import dialog #96279

and-rad opened this issue Aug 29, 2024 · 1 comment · Fixed by #96283

Comments

@and-rad
Copy link
Contributor

and-rad commented Aug 29, 2024

Tested versions

v4.4.dev.custom_build [fd7239c]

System information

Windows 10, GeForce RTX 3070, Vulkan

Issue description

It is currently impossible to select any of the disk drives when trying to import or scan projects in the project manager.

Steps to reproduce

On a Windows computer with multiple drives

  • open the Godot project manager and click import or Scan
  • try to select any of the drives listed in the dropdown menu
  • observe how the drive isn't selected and the list of folders and files doesn't update

Current workaround: Enter the path directly into the text field next to the dropdown menu.

Minimal reproduction project (MRP)

No MRP needed, but the culprit is likely #91902, so 4.3 is not affected. I didn't bisect, but looking at the changes introduced in that PR, this is what's happening:

  • When a drive is selected, DirAccessWindows::fix_path checks if the drive path, for example D: is a relative path. If yes, it's appended to the current path.
  • D:, as well as C: and any other drive is recognized as a relative path because String::is_relative_path only checks for the :/ and :\patterns, but not a single colon, like in D:.
  • This causes the drive letter to be appended to the current directory, which of course doesn't exist, which causes the function to change the current path to fail.
@and-rad
Copy link
Contributor Author

and-rad commented Aug 29, 2024

I would supply a fix myself, but I don't know what the correct way forward is. A simple solution would be to just change the text in the dropdown menu from DRIVE_LETTER: to DRIVE_LETTER:\, but that sounds hacky and might introduce bugs elsewhere. Slightly more correct solutions may be that a path is recognized as an absolute path if it ends with a colon (of course only on windows) or if it is exactly two characters long and the second one is a colon.

Shouldn't there be Microsoft specs somewhere that define exactly what a valid path is composed of?

Edit: I found some Microsoft specs here and here. From these it's pretty clear that C: is, in fact, not a valid absolute path and should probably not be treated as such. So the code in String::is_relative_path should probably be left as it is.

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

Successfully merging a pull request may close this issue.

3 participants