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

Trying to open the folder of a project from the Project Manager (or a project's user:// from the editor) opens its parent folder instead #79044

Closed
rblopes opened this issue Jul 4, 2023 · 5 comments · Fixed by #79087

Comments

@rblopes
Copy link

rblopes commented Jul 4, 2023

Godot version

v4.1.rc3.official [cdd2313]

System information

Godot v4.1.rc3 - KDE neon 5.27 22.04 - Vulkan (Forward+) - integrated AMD Radeon Vega 11 Graphics (RADV RAVEN) () - AMD Ryzen 5 3400G with Radeon Vega Graphics (8 Threads)

Issue description

Trying to open the folder containing a project from the Project Manager, by clicking the small folder icon beneath the project's name, opens its parent folder in the file manager instead.

Likewise, trying to open the project's data folder from the game editor shows me its parent folder, either the one containing the data folders of all other Godot projects, or even my ~/.local/share if I set a custom data folder in the project settings.

Using the shortcut menu to open any folder in the File System dock works as intended.

Steps to reproduce

  • In the Project Manager projects list, click the folder icon under the project name;
  • Inside the game editor, use the Project → Open User Data Folder menu.

Minimal reproduction project

N/A

@akien-mga
Copy link
Member

akien-mga commented Jul 5, 2023

Confirmed on Linux (Mageia 9, KDE) with both 4.1-dev2 and 4.1-rc3. It doesn't happen in 4.0-stable, 4.0.3-stable, or 4.1-dev1.

So it's a regression in dev2, probably from #69698. CC @Daylily-Zeleen @KoBeWi @bruvzg

Probably caused by:

godot/core/os/os.cpp

Lines 301 to 303 in cdd2313

if (!p_path.ends_with("/")) {
p_path = p_path.get_base_dir();
}

@akien-mga akien-mga added this to the 4.2 milestone Jul 5, 2023
@KoBeWi
Copy link
Member

KoBeWi commented Jul 5, 2023

Can't reproduce it on Windows.

@bruvzg
Copy link
Member

bruvzg commented Jul 5, 2023

Can't reproduce on macOS (but it's expected, there's custom shell_show_in_file_manager implementation).

It probably should do something like this, instead of using ends_with("/").

	if (!DirAccess::dir_exists_absolute(p_path) && p_open_folder) {
		p_path = p_path.get_base_dir();
	}

@Daylily-Zeleen
Copy link
Contributor

Currently shell_show_in_file_manager only implement on Windows and macOS, will fallback to shell_open on other platform.
The document is need updated.

@Daylily-Zeleen
Copy link
Contributor

Daylily-Zeleen commented Jul 6, 2023

It probably should do something like this, instead of using ends_with("/").

	if (!DirAccess::dir_exists_absolute(p_path) && p_open_folder) {
		p_path = p_path.get_base_dir();
	}

It seem better, but I think we no need check p_open_folder here.
If it is false, it will open the file when fallback to shell_open, this is not expected. If user passed a valid file path, it should still open its folder in file manager.

I will open a pr to fix this.

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