Merge pull request #98397 from adamscott/add-tmp-support

Add temp utilities (alias `OS::get_temp_dir()`, `FileAccess::create_temp()`, and `DirAccess::create_temp()`)
This commit is contained in:
Thaddeus Crews
2024-12-03 14:40:59 -06:00
26 changed files with 331 additions and 7 deletions

View File

@@ -54,6 +54,10 @@ String EditorPaths::get_cache_dir() const {
return cache_dir;
}
String EditorPaths::get_temp_dir() const {
return temp_dir;
}
String EditorPaths::get_project_data_dir() const {
return project_data_dir;
}
@@ -161,6 +165,7 @@ EditorPaths::EditorPaths() {
config_dir = data_dir;
cache_path = exe_path;
cache_dir = data_dir.path_join("cache");
temp_dir = data_dir.path_join("temp");
} else {
// Typically XDG_DATA_HOME or %APPDATA%.
data_path = OS::get_singleton()->get_data_path();
@@ -175,6 +180,7 @@ EditorPaths::EditorPaths() {
} else {
cache_dir = cache_path.path_join(OS::get_singleton()->get_godot_dir_name());
}
temp_dir = OS::get_singleton()->get_temp_path();
}
paths_valid = (!data_path.is_empty() && !config_path.is_empty() && !cache_path.is_empty());