You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-07 12:30:27 +00:00
Expose OS data directory getter methods
This can be used by editor plugins and non-game applications to store data in the correct directories according to the XDG Base Directory specification.
This commit is contained in:
@@ -1085,6 +1085,21 @@ int64_t _OS::get_native_handle(HandleType p_handle_type) {
|
||||
return (int64_t)OS::get_singleton()->get_native_handle(p_handle_type);
|
||||
}
|
||||
|
||||
String _OS::get_config_dir() const {
|
||||
// Exposed as `get_config_dir()` instead of `get_config_path()` for consistency with other exposed OS methods.
|
||||
return OS::get_singleton()->get_config_path();
|
||||
}
|
||||
|
||||
String _OS::get_data_dir() const {
|
||||
// Exposed as `get_data_dir()` instead of `get_data_path()` for consistency with other exposed OS methods.
|
||||
return OS::get_singleton()->get_data_path();
|
||||
}
|
||||
|
||||
String _OS::get_cache_dir() const {
|
||||
// Exposed as `get_cache_dir()` instead of `get_cache_path()` for consistency with other exposed OS methods.
|
||||
return OS::get_singleton()->get_cache_path();
|
||||
}
|
||||
|
||||
bool _OS::is_debug_build() const {
|
||||
#ifdef DEBUG_ENABLED
|
||||
return true;
|
||||
@@ -1321,6 +1336,9 @@ void _OS::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("get_user_data_dir"), &_OS::get_user_data_dir);
|
||||
ClassDB::bind_method(D_METHOD("get_external_data_dir"), &_OS::get_external_data_dir);
|
||||
ClassDB::bind_method(D_METHOD("get_system_dir", "dir"), &_OS::get_system_dir);
|
||||
ClassDB::bind_method(D_METHOD("get_config_dir"), &_OS::get_config_dir);
|
||||
ClassDB::bind_method(D_METHOD("get_data_dir"), &_OS::get_data_dir);
|
||||
ClassDB::bind_method(D_METHOD("get_cache_dir"), &_OS::get_cache_dir);
|
||||
ClassDB::bind_method(D_METHOD("get_unique_id"), &_OS::get_unique_id);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("is_ok_left_and_cancel_right"), &_OS::is_ok_left_and_cancel_right);
|
||||
|
||||
Reference in New Issue
Block a user