Merge pull request #17420 from marcelofg55/fscache_err_checks

Added error checks for fscache saving
This commit is contained in:
Rémi Verschelde 2018-03-14 09:21:31 +01:00 committed by GitHub
commit db289e0e85
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 11 deletions

View file

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

View file

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