aboutsummaryrefslogtreecommitdiff
path: root/core/globals.cpp
diff options
context:
space:
mode:
authorJuan Linietsky2017-02-04 21:02:52 -0300
committerJuan Linietsky2017-02-04 21:02:52 -0300
commitaf3fabeb7745e6f7f4e7fe7a299bdd234fff26a6 (patch)
tree7573b4f6fd088da5e33ed0484d76787fc798e8f3 /core/globals.cpp
parent102b5fce85ffa14887bb08433f7eb571c7aafd81 (diff)
downloadgodot-af3fabeb7745e6f7f4e7fe7a299bdd234fff26a6.tar.gz
godot-af3fabeb7745e6f7f4e7fe7a299bdd234fff26a6.tar.zst
godot-af3fabeb7745e6f7f4e7fe7a299bdd234fff26a6.zip
Diffstat (limited to 'core/globals.cpp')
-rw-r--r--core/globals.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/core/globals.cpp b/core/globals.cpp
index ab17e9b2b..e748f561f 100644
--- a/core/globals.cpp
+++ b/core/globals.cpp
@@ -38,6 +38,8 @@
#include "io/file_access_network.h"
#include "variant_parser.h"
+#define FORMAT_VERSION 3
+
GlobalConfig *GlobalConfig::singleton=NULL;
GlobalConfig *GlobalConfig::get_singleton() {
@@ -491,6 +493,14 @@ Error GlobalConfig::_load_settings(const String p_path) {
}
if (assign!=String()) {
+ if (section==String() && assign=="config_version") {
+ int config_version = value;
+ if (config_version > FORMAT_VERSION) {
+ memdelete(f);
+ ERR_FAIL_COND_V(config_version > FORMAT_VERSION,ERR_FILE_CANT_OPEN);
+ }
+
+ }
set(section+"/"+assign,value);
} else if (next_tag.name!=String()) {
section=next_tag.name;
@@ -608,6 +618,9 @@ Error GlobalConfig::_save_settings_text(const String& p_file,const Map<String,Li
ERR_FAIL_COND_V(err,err)
}
+ file->store_string("config_version="+itos(FORMAT_VERSION)+"\n");
+
+
for(Map<String,List<String> >::Element *E=props.front();E;E=E->next()) {
if (E!=props.front())