Added error checks for fscache saving

This commit is contained in:
Marcelo Fernandez 2018-03-10 16:47:10 -03:00
parent 93a3d1714e
commit 06e537fec5
2 changed files with 16 additions and 11 deletions

View File

@ -274,9 +274,13 @@ void EditorFileSystem::_scan_filesystem() {
memdelete(d); memdelete(d);
f = FileAccess::open(fscache, FileAccess::WRITE); f = FileAccess::open(fscache, FileAccess::WRITE);
if (f == NULL) {
ERR_PRINTS("Error writing fscache: " + fscache);
} else {
_save_filesystem_cache(new_filesystem, f); _save_filesystem_cache(new_filesystem, f);
f->close(); f->close();
memdelete(f); memdelete(f);
}
scanning = false; scanning = false;
} }
@ -285,10 +289,14 @@ void EditorFileSystem::_save_filesystem_cache() {
String fscache = EditorSettings::get_singleton()->get_project_settings_path().plus_file("filesystem_cache3"); String fscache = EditorSettings::get_singleton()->get_project_settings_path().plus_file("filesystem_cache3");
FileAccess *f = FileAccess::open(fscache, FileAccess::WRITE); FileAccess *f = FileAccess::open(fscache, FileAccess::WRITE);
if (f == NULL) {
ERR_PRINTS("Error writing fscache: " + fscache);
} else {
_save_filesystem_cache(filesystem, f); _save_filesystem_cache(filesystem, f);
f->close(); f->close();
memdelete(f); memdelete(f);
} }
}
void EditorFileSystem::_thread_func(void *_userdata) { void EditorFileSystem::_thread_func(void *_userdata) {

View File

@ -856,11 +856,8 @@ void EditorSettings::save() {
Error err = ResourceSaver::save(singleton->config_file_path, singleton); Error err = ResourceSaver::save(singleton->config_file_path, singleton);
if (err != OK) { if (err != OK) {
ERR_PRINT("Can't Save!"); ERR_PRINTS("Error saving editor settings to " + singleton->config_file_path);
return; } else if (OS::get_singleton()->is_stdout_verbose()) {
}
if (OS::get_singleton()->is_stdout_verbose()) {
print_line("EditorSettings Save OK!"); print_line("EditorSettings Save OK!");
} }
} }