godotengine / godot-proposals

Godot Improvement Proposals (GIPs)
MIT License
1.07k stars 69 forks source link

Add an option to use '\' instead of '/' as a file path separator when using "Copy Absolute Path" in the editor's FileSystem dock #10036

Open Tenzenmaster opened 1 week ago

Tenzenmaster commented 1 week ago

Describe the project you are working on

A short 2D pixel-art horror game

Describe the problem or limitation you are having in your project

Using the new "Copy Absolute Path" option introduced in PR #90421, the file path that is copied uses forward slash '/' as the file path separator. On windows this makes it difficult to use in combination with native programs such as the Windows File Explorer. For example, copying a Godot folder's absolute path and pasting it into Windows File Explorer's "path to extract zipped folder to" prompt returns an error until I manually replace each forward slash '/' with a backslash '\'.

Describe the feature / enhancement and how it helps to overcome the problem or limitation

Add an option in the Editor Settings to use backslashes '\' instead of forward slashes '/' when getting/copying OS file paths. This way, the path copied from the editor can be directly pasted into windows programs that don't accept forward slashes.

Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams

In Editor Settings/FileSystem/Directories:

...

Now in the Godot FileSystem dock:

If this enhancement will not be used often, can it be worked around with a few lines of script?

This would require editing the functionality of PR #90421 and the Editor Settings, and any other places in the editor that give you OS file paths to copy, which would involve editing the C++ source of the Godot Engine.

Is there a reason why this should be core and not an add-on in the asset library?

It is not intrusive and would be useful to most Windows users when working with the Windows filesystem and Godot.

KoBeWi commented 1 week ago

But Windows File Explorer supports both slash types 🤔

Calinou commented 1 week ago

Some old Windows apps won't let you paste paths with forward slashes in them, so I think we should always convert to backslash when copying an absolute path on Windows. Godot accepts both forms either way.

I don't think this needs to be an editor setting – we should just always do it :slightly_smiling_face:

KoBeWi commented 1 week ago

Well on the other hand, some apps only accept forward slashes. E.g. VS Code JSON config only supports forward paths, and ironically copying file paths in the same program gives you backward-slash, so it's incompatible with itself.

Though GIMP is one of the programs that only supports backward slashes on Windows. It's generally inconsistent, hence option makes sense, as it depends on your workflow.