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

FileDialog considers /path/to/dir/'s parent directory to be path/to/dir #80750

Closed
mieldepoche opened this issue Aug 18, 2023 · 4 comments · Fixed by #80821
Closed

FileDialog considers /path/to/dir/'s parent directory to be path/to/dir #80750

mieldepoche opened this issue Aug 18, 2023 · 4 comments · Fixed by #80821
Milestone

Comments

@mieldepoche
Copy link
Contributor

mieldepoche commented Aug 18, 2023

Godot version

4.1.1

System information

linux

Issue description

  • When favoriting a path in a FileDialog, clicking on it travels to path/to/dir/.
  • When going up a level from there, it doesn't go to path/to but to path/to/dir (without the /).
simplescreenrecorder-2023-08-18_09.38.37.webm

The problem is either (or both) that:

  • loaded path has a trailing /
  • parent dir of stuff/ is considered to be stuff

Steps to reproduce

favorite a directory and use the feature to navigate to it

Minimal reproduction project

any (i.e. the project manager's "new project" dialog has one)

@AThousandShips
Copy link
Member

Can you confirm this on 4.1.1? Please make sure bugs are present on an up to date version

@mieldepoche
Copy link
Contributor Author

Can you confirm this on 4.1.1

ah, missed that one. It does.

@aXu-AP
Copy link
Contributor

aXu-AP commented Aug 18, 2023

I couldn't replicate on Windows 10, so maybe this is dependent on OS?

Edit: Can replicate on Web editor ✔

@Alex2782
Copy link
Contributor

Can the function _go_up() be modified for this?

I believe get_base_dir() is working as it should be. (190 results in 80 files)
The function change_dir exists 4 times, also for Android.

void EditorFileDialog::_go_up() {

to:

void EditorFileDialog::_go_up() {
	String cur_dir = get_current_dir();

	if (cur_dir.ends_with("/")) {
		cur_dir = cur_dir.substr(0, cur_dir.length() - 1);
	}

	dir_access->change_dir(cur_dir.get_base_dir());
	update_file_list();
	update_dir();
	_push_history();
}

Test on MacOS:

Screen-2023-08-20-000912.mp4

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.

6 participants