diff options
author | kobewi <kobewi4e@gmail.com> | 2021-01-17 01:09:17 +0100 |
---|---|---|
committer | kobewi <kobewi4e@gmail.com> | 2021-02-09 14:44:44 +0100 |
commit | c390c82014c23d7396cec731fceb515a354fe752 (patch) | |
tree | b84057edb287e3a0e7a7e3270d91d3478218f38b /core | |
parent | 412125f1910c78d0b6a969ac952cddbad6ca0df4 (diff) |
Detect external modification of project.godot
Diffstat (limited to 'core')
-rw-r--r-- | core/config/project_settings.cpp | 7 | ||||
-rw-r--r-- | core/config/project_settings.h | 4 |
2 files changed, 9 insertions, 2 deletions
diff --git a/core/config/project_settings.cpp b/core/config/project_settings.cpp index 70e8133eaa..9b28ef7b81 100644 --- a/core/config/project_settings.cpp +++ b/core/config/project_settings.cpp @@ -597,6 +597,7 @@ Error ProjectSettings::_load_settings_text(const String &p_path) { // If we're loading a project.godot from source code, we can operate some // ProjectSettings conversions if need be. _convert_to_last_version(config_version); + last_save_time = FileAccess::get_modified_time(get_resource_path().plus_file("project.godot")); return OK; } else if (err != OK) { ERR_PRINT("Error parsing " + p_path + " at line " + itos(lines) + ": " + error_text + " File might be corrupted."); @@ -676,7 +677,11 @@ void ProjectSettings::clear(const String &p_name) { } Error ProjectSettings::save() { - return save_custom(get_resource_path().plus_file("project.godot")); + Error error = save_custom(get_resource_path().plus_file("project.godot")); + if (error == OK) { + last_save_time = FileAccess::get_modified_time(get_resource_path().plus_file("project.godot")); + } + return error; } Error ProjectSettings::_save_settings_binary(const String &p_file, const Map<String, List<String>> &props, const CustomMap &p_custom, const String &p_custom_features) { diff --git a/core/config/project_settings.h b/core/config/project_settings.h index 59c56c23c2..645506f302 100644 --- a/core/config/project_settings.h +++ b/core/config/project_settings.h @@ -78,6 +78,8 @@ protected: int last_order = NO_BUILTIN_ORDER_BASE; int last_builtin_order = 0; + uint64_t last_save_time = 0; + Map<StringName, VariantContainer> props; String resource_path; Map<StringName, PropertyInfo> custom_prop_info; @@ -113,7 +115,6 @@ protected: Error _setup(const String &p_path, const String &p_main_pack, bool p_upwards = false); -protected: static void _bind_methods(); public: @@ -150,6 +151,7 @@ public: Error save(); void set_custom_property_info(const String &p_prop, const PropertyInfo &p_info); const Map<StringName, PropertyInfo> &get_custom_property_info() const; + uint64_t get_last_saved_time() { return last_save_time; } Vector<String> get_optimizer_presets() const; |