From EditorSettings::create
:
if (OS::get_singleton()->has_environment("APPDATA")) {
// Most likely under windows, save here
config_path=OS::get_singleton()->get_environment("APPDATA");
config_dir=String(_MKSTR(VERSION_SHORT_NAME)).capitalize();
} else if (OS::get_singleton()->has_environment("HOME")) {
config_path=OS::get_singleton()->get_environment("HOME");
config_dir="."+String(_MKSTR(VERSION_SHORT_NAME)).to_lower();
}
The settings directory is decided and created here and the OS
class has no way to set a custom settings directory.
I am working on the Haiku port and there we do not use ~/.appname
for storing settings but ~/config/settings/appname
.
So my proposal is to add an OS::get_settings_dir
method and use it in EditorSettings::create
.
makes sense
On Fri, Jan 29, 2016 at 7:26 PM, Костадин Дамянов [email protected]
wrote:
From EditorSettings::create:
if (OS::get_singleton()->has_environment("APPDATA")) { // Most likely under windows, save here config_path=OS::get_singleton()->get_environment("APPDATA"); config_dir=String(_MKSTR(VERSION_SHORT_NAME))capitalize(); } else if (OS::get_singleton()->has_environment("HOME")) { config_path=OS::get_singleton()->get_environment("HOME"); config_dir=""+String(_MKSTR(VERSION_SHORT_NAME))to_lower(); }
The settings directory is decided and created here and the OS class has
no way to set a custom settings directory
I am working on the Haiku port and there we do not use ~/appname for
storing settings but ~/config/settings/appnameSo my proposal is to add an OS::get_settings_dir method and use it in
EditorSettings::create—
Reply to this email directly or view it on GitHub
https://github.com/godotengine/godot/issues/3513.
offtopic but i like haiku os. good luck .i was actually wondering if there is a haiku os port .
Does Haiku define XDG_CONFIG_HOME? That's typically what we should try to use before defaulting to other custom paths. On most Linux distros it would be ${HOME}/.config
, then "/godot" would have to be appended to get the full path.
It appears that it supports it:
~> echo $XDG_CONFIG_HOME
/boot/home/config/settings
So appending /godot
would work :)
So we should probably change the above code to:
if (OS::get_singleton()->has_environment("XDG_CONFIG_HOME")) {
// FreeDesktop compliant path, we use it
config_path=OS::get_singleton()->get_environment("XDG_CONFIG_HOME");
config_dir=String(_MKSTR(VERSION_SHORT_NAME)).to_lower();
} else if (OS::get_singleton()->has_environment("APPDATA")) {
// Most likely under windows, save here
config_path=OS::get_singleton()->get_environment("APPDATA");
config_dir=String(_MKSTR(VERSION_SHORT_NAME)).capitalize();
} else if (OS::get_singleton()->has_environment("HOME")) {
config_path=OS::get_singleton()->get_environment("HOME");
config_dir="."+String(_MKSTR(VERSION_SHORT_NAME)).to_lower();
}
The above snippet means that on Windows if XDG_CONFIG_HOME == APPDATA, it will use a lowecase "godot" suffix instead of "Godot", but I'm not sure it's a big deal :) Or we can have APPDATA be checked first and only then XDG_CONFIG_HOME, though that kind of defeats the purpose of this variable on Windows platforms then.
never seen XDG_CONFIG_HOME, seems to be missing in Ubuntu. Also, I believe
we should maybe separate by major version, not minor version
On Mon, Feb 1, 2016 at 9:39 AM, Rémi Verschelde [email protected]
wrote:
So we should probably change the above code to:
if (OS::get_singleton()->has_environment("XDG_CONFIG_HOME")) { // FreeDesktop compliant path, we use it config_path=OS::get_singleton()->get_environment("XDG_CONFIG_HOME"); config_dir=String(_MKSTR(VERSION_SHORT_NAME)).to_lower(); } else if (OS::get_singleton()->has_environment("APPDATA")) { // Most likely under windows, save here config_path=OS::get_singleton()->get_environment("APPDATA"); config_dir=String(_MKSTR(VERSION_SHORT_NAME)).capitalize(); } else if (OS::get_singleton()->has_environment("HOME")) { config_path=OS::get_singleton()->get_environment("HOME"); config_dir="."+String(_MKSTR(VERSION_SHORT_NAME)).to_lower(); }
The above snippet means that on Windows if XDG_CONFIG_HOME == APPDATA, it
will use a lowecase "godot" suffix instead of "Godot", but I'm not sure
it's a big deal :) Or we can have APPDATA be checked first and only then
XDG_CONFIG_HOME, though that kind of defeats the purpose of this variable
on Windows platforms then.—
Reply to this email directly or view it on GitHub
https://github.com/godotengine/godot/issues/3513#issuecomment-177955381.
also, it's too late now to change this, don't want to break compatiblity.
Will write down to do it for 3.0
On Mon, Feb 1, 2016 at 9:41 AM, Juan Linietsky [email protected] wrote:
never seen XDG_CONFIG_HOME, seems to be missing in Ubuntu. Also, I believe
we should maybe separate by major version, not minor versionOn Mon, Feb 1, 2016 at 9:39 AM, Rémi Verschelde [email protected]
wrote:So we should probably change the above code to:
if (OS::get_singleton()->has_environment("XDG_CONFIG_HOME")) { // FreeDesktop compliant path, we use it config_path=OS::get_singleton()->get_environment("XDG_CONFIG_HOME"); config_dir=String(_MKSTR(VERSION_SHORT_NAME)).to_lower(); } else if (OS::get_singleton()->has_environment("APPDATA")) { // Most likely under windows, save here config_path=OS::get_singleton()->get_environment("APPDATA"); config_dir=String(_MKSTR(VERSION_SHORT_NAME)).capitalize(); } else if (OS::get_singleton()->has_environment("HOME")) { config_path=OS::get_singleton()->get_environment("HOME"); config_dir="."+String(_MKSTR(VERSION_SHORT_NAME)).to_lower(); }
The above snippet means that on Windows if XDG_CONFIG_HOME == APPDATA, it
will use a lowecase "godot" suffix instead of "Godot", but I'm not sure
it's a big deal :) Or we can have APPDATA be checked first and only then
XDG_CONFIG_HOME, though that kind of defeats the purpose of this variable
on Windows platforms then.—
Reply to this email directly or view it on GitHub
https://github.com/godotengine/godot/issues/3513#issuecomment-177955381
.
The ubuntu docs mention XDG_CONFIG_HOME: here
This variable is typically unset since a sensible default fall-back value was defined by the specifications.
The XDG Base Directory Specification says:
$XDG_CONFIG_HOME defines the base directory relative to which user specific configuration files should be stored. If $XDG_CONFIG_HOME is either not set or empty, a default equal to $HOME/.config should be used.
Other distributions may have it though. So I think the solution suggested by @akien-mga makes sense except in the last case where we may fall back to ~/.config
instead of `HOME
oh ok. I noted it down to fix this in 3.0, so we can happily break
compatibility
On Mon, Feb 1, 2016 at 10:21 AM, Костадин Дамянов [email protected]
wrote:
The ubuntu docs mention XDG_CONFIG_HOME: here
https://help.ubuntu.com/community/EnvironmentVariablesThis variable is typically unset since a sensible default fall-back value
was defined by the specifications.Other distributions may have it though. So I think the solution suggested
by @akien-mga https://github.com/akien-mga makes sense except in the
last case where we may fall back to ~/.config instead of HOME.—
Reply to this email directly or view it on GitHub
https://github.com/godotengine/godot/issues/3513#issuecomment-177969221.
apparently is a bug in ubuntu https://bugs.launchpad.net/ubuntu/+source/xdg-user-dirs/+bug/1122613
actually nvm is set to do not fix so i guess ubuntu doesn't like XDG paths
after discussing, and like many other softwares, we decided for the time being to ignore XDG_CONFIG_HOME and/or similar environment variables and keep using ~/.godot on unix. Closing.
we decided for the time being to ignore XDG_CONFIG_HOME and/or similar environment variables and keep using ~/.godot on unix
Did we? :)
Reopening as I finally convinced reduz that it's not too bad an idea, and I'm working on this.
I'll implement support for XDG_CONFIG_HOME
, XDG_DATA_HOME
and XDG_CACHE_HOME
and use the three of them for the editor, splitting config (editor settings, layouts, etc.) from data (export templates, logs, etc.) and cache (current "tmp" folder).
For games, we'll expose only XDG_DATA_HOME
, as we consider it too confusing for devs to have several paths to their game data (user://
). So the default user://
will resolve to XDG_DATA_HOME/godot/app_userdata
(~/.local/share/godot/app_userdata/
on most Linux distros), with an option to change that path to XDG_DATA_HOME/[<studio>/]<game>
).
For Windows and co, nothing changes, everything will still be all in the same folder, the interface will be transparent to the user.
Here's what a typical setup would look like on Linux:
~/.cache/godot/ (ex "tmp/")
~/.config/godot/
~/.config/godot/projects/ (ex "config/")
~/.config/godot/editor_*.{cfg,tres}
~/.config/godot/script_templates/
~/.config/godot/text_editor_themes/
~/.local/share/godot/app_userdata/
~/.local/share/godot/logs/
~/.local/share/godot/mono/
~/.local/share/godot/templates/
Most helpful comment
Reopening as I finally convinced reduz that it's not too bad an idea, and I'm working on this.
I'll implement support for
XDG_CONFIG_HOME
,XDG_DATA_HOME
andXDG_CACHE_HOME
and use the three of them for the editor, splitting config (editor settings, layouts, etc.) from data (export templates, logs, etc.) and cache (current "tmp" folder).For games, we'll expose only
XDG_DATA_HOME
, as we consider it too confusing for devs to have several paths to their game data (user://
). So the defaultuser://
will resolve toXDG_DATA_HOME/godot/app_userdata
(~/.local/share/godot/app_userdata/
on most Linux distros), with an option to change that path toXDG_DATA_HOME/[<studio>/]<game>
).For Windows and co, nothing changes, everything will still be all in the same folder, the interface will be transparent to the user.