Răsfoiți Sursa

When starting up try creating directories recursively

Previously we had a check to see if cache and data directories exist and
another check to try to make them if they do not. However the second
check was never reached if we don't have the directories in question.

Furthermore for cache directories on Linux people who never started a
desktop environment we need to recurisively create the XDG directory as
well as the godot specific directory.

This fixes #17963
Hein-Pieter van Braam 7 ani în urmă
părinte
comite
321ac5ae13
1 a modificat fișierele cu 3 adăugiri și 15 ștergeri
  1. 3 15
      editor/editor_settings.cpp

+ 3 - 15
editor/editor_settings.cpp

@@ -755,7 +755,7 @@ void EditorSettings::create() {
 		}
 		}
 
 
 		if (dir->change_dir(data_dir) != OK) {
 		if (dir->change_dir(data_dir) != OK) {
-			dir->make_dir(data_dir);
+			dir->make_dir_recursive(data_dir);
 			if (dir->change_dir(data_dir) != OK) {
 			if (dir->change_dir(data_dir) != OK) {
 				ERR_PRINT("Cannot create data directory!");
 				ERR_PRINT("Cannot create data directory!");
 				memdelete(dir);
 				memdelete(dir);
@@ -771,14 +771,8 @@ void EditorSettings::create() {
 
 
 		// Validate/create cache dir
 		// Validate/create cache dir
 
 
-		if (dir->change_dir(cache_path) != OK) {
-			ERR_PRINT("Cannot find path for cache directory!");
-			memdelete(dir);
-			goto fail;
-		}
-
 		if (dir->change_dir(cache_dir) != OK) {
 		if (dir->change_dir(cache_dir) != OK) {
-			dir->make_dir(cache_dir);
+			dir->make_dir_recursive(cache_dir);
 			if (dir->change_dir(cache_dir) != OK) {
 			if (dir->change_dir(cache_dir) != OK) {
 				ERR_PRINT("Cannot create cache directory!");
 				ERR_PRINT("Cannot create cache directory!");
 				memdelete(dir);
 				memdelete(dir);
@@ -788,14 +782,8 @@ void EditorSettings::create() {
 
 
 		// Validate/create config dir and subdirectories
 		// Validate/create config dir and subdirectories
 
 
-		if (dir->change_dir(config_path) != OK) {
-			ERR_PRINT("Cannot find path for config directory!");
-			memdelete(dir);
-			goto fail;
-		}
-
 		if (dir->change_dir(config_dir) != OK) {
 		if (dir->change_dir(config_dir) != OK) {
-			dir->make_dir(config_dir);
+			dir->make_dir_recursive(config_dir);
 			if (dir->change_dir(config_dir) != OK) {
 			if (dir->change_dir(config_dir) != OK) {
 				ERR_PRINT("Cannot create config directory!");
 				ERR_PRINT("Cannot create config directory!");
 				memdelete(dir);
 				memdelete(dir);