godotengine / godot-proposals

Godot Improvement Proposals (GIPs)
MIT License
1.16k stars 97 forks source link

Improve the self-contained mode for greater flexibility and cleanliness #2474

Open Calinou opened 3 years ago

Calinou commented 3 years ago

Describe the project you are working on

The Godot editor :slightly_smiling_face:

Describe the problem or limitation you are having in your project

The Godot editor has a self-contained mode. It works well for the editor's purposes, but it has several limitations:

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

Note: The ._sc_ approach may be supplemented by command line arguments or environment variables, but it won't be removed as this is the only approach that carries across different PCs. For instance, if you copy a Godot project on an USB stick, the ._sc_ file can be copied along it. This isn't the case for command line arguments or environment variables, unless you create OS-specific launcher scripts.

Relevant discussion on the Godot Contributors Chat

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

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

For the editor, no. For exported projects, yes, but it needs to be done consciously by the project developer every time they're writing a file somewhere. This implies never relying on user:// and using OS.get_executable_path().get_base_dir().path_join("project_data") instead.

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

See above.

Keywords for easier searching: selfcontained

mrjustaguy commented 3 years ago

To make it easier for stuff to be saved in the same folder as the game, something like game:// being added would help, instead of having that very long line used often.. Might even be worth it stand alone to add that regardless of self contained mode.

Note: res:// might be what I suggested, however I'm not sure how that works on an exported project, as in idk if saving to res would try to save to the .pck and not a folder outside..

res:// works as that behemoth of a line, so it's really all about using res:// over user://

Calinou commented 3 years ago

res:// works as that behemoth of a line, so it's really all about using res:// over user://

res:// isn't guaranteed to be writable to in an exported project (even more so on mobile/web platforms). Also, when using res:// to save user data, there's no guarantee that you won't accidentally overwrite game files :wink: