0 votes

Hello everyone, I am very new to Godot and I don't know if what I would like to achieve is doable or if it even makes sense, here is what I have in mind:

I am implementing a "character editor" inside my 2D game and I would like the user to have relatively free access to the character graphical resources (sprites) directly from the file system. I would like the game, once exported and started, to create a folder in the same directory where the game executable is, and bring in a few default assets that are inbuilt in the game, just to give the user some context of where things are in the foreseen folder structure for the assets.

I tried to get the game's path with ProjectSettings.globalize_path("res://"), but it always returns the folder of the project, while I would like the path of the exported game, wherever it is in the file system.

What can I do about this issue? is there a better way to deal with the issue? Thank you in advance :) :)

Godot version Godot 3.2.3.stable_official 64bit, Linux Mint 20.1 & Windows10.
in Engine by (12 points)

What about using the "user://" directory?

2 Answers

0 votes

https://docs.godotengine.org/en/stable/classes/class_editorfilesystem.html

Edit

To be clear res:\\ may not exist in export.

From https://docs.godotengine.org/en/stable/tutorials/io/data_paths.html#user-path-persistent-data

While the project is running, it is a common scenario that the
resource path will be read-only, due to it being inside a package,
self-contained executable, or system-wide install location.

by (889 points)
edited by
0 votes

You can use OS.get_executable_path()

by (72 points)

The "equivalent" of res:// in an exported project would be OS.get_executable_path().get_base_dir(), since you want a directory path, not a file path.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.