The Wayback Machine - https://web.archive.org/web/20200529162250/https://github.com/godotengine/godot/issues/38152
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

ProjectSettings.save_custom returns error ERR_FILE_UNRECOGNIZED for any path #38152

Closed
p10tr3k opened this issue Apr 23, 2020 · 5 comments
Closed

Comments

@p10tr3k
Copy link
Contributor

@p10tr3k p10tr3k commented Apr 23, 2020

Godot version:
v3.2.2.rc.custom_build.36a30f681

OS/device including version:
Window 10

Issue description:
I'm trying to save ProjectSettings at runtime using save_custom to location "user://override.cfg", but this action returns error ERR_FILE_UNRECOGNIZED. Actually this method returns this error for any path. Is it allowed to call it at runtime or only in tool? I want to use ProjectSettings mechanism at runtime for storing some user configurations.

@KoBeWi
Copy link
Contributor

@KoBeWi KoBeWi commented Apr 29, 2020

The file needs .godot or .binary extension to work. The docs should mention that.

@Calinou
Copy link
Member

@Calinou Calinou commented Apr 29, 2020

@pgoral Using the ConfigFile class is probably a better idea to store user configuration. When you save the project settings, you'll literally save all settings, including settings the user isn't supposed to change such as internal Godot settings.

@KoBeWi Could we remove this restriction?

@KoBeWi
Copy link
Contributor

@KoBeWi KoBeWi commented Apr 29, 2020

The restriction is hardcoded here:

if (p_path.ends_with(".godot"))
return _save_settings_text(p_path, props, p_custom, custom_features);
else if (p_path.ends_with(".binary"))
return _save_settings_binary(p_path, props, p_custom, custom_features);
else {
ERR_FAIL_V_MSG(ERR_FILE_UNRECOGNIZED, "Unknown config file format: " + p_path + ".");
}

Removing it would be easy if we decided to do that.

@p10tr3k
Copy link
Contributor Author

@p10tr3k p10tr3k commented Apr 29, 2020

I think we should leave it like this, but only document it properly

@NetonD
Copy link

@NetonD NetonD commented Apr 30, 2020

I'm new here and in world of opensource, can i already open a pr describing this in doc?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.