Fix file_dialog's root_subfolder on Windows
`root_prefix` either contains an empty string or the current root including the drive letter. This means that the previous logic would never ever match since `dir_access->get_current_dir(false)` explicitly excludes the drive letter. This change removes this boolean parameter so we compare paths in a way that can match. I've had a look at the implementations for other platforms for `DirAccess::get_current_dir(bool include_drive)` and outside Windows none seem to consider the `include_drive` parameter which makes me believe that this change won't break other platforms.
This commit is contained in:
@ -1448,7 +1448,7 @@ void FileDialog::_change_dir(const String &p_new_dir) {
|
||||
} else {
|
||||
String old_dir = dir_access->get_current_dir();
|
||||
dir_access->change_dir(p_new_dir);
|
||||
if (!dir_access->get_current_dir(false).begins_with(root_prefix)) {
|
||||
if (!dir_access->get_current_dir().begins_with(root_prefix)) {
|
||||
dir_access->change_dir(old_dir);
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user