summaryrefslogtreecommitdiff
path: root/core/project_settings.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'core/project_settings.cpp')
-rw-r--r--core/project_settings.cpp27
1 files changed, 19 insertions, 8 deletions
diff --git a/core/project_settings.cpp b/core/project_settings.cpp
index 7704c7b377..a01a8a35c6 100644
--- a/core/project_settings.cpp
+++ b/core/project_settings.cpp
@@ -5,8 +5,8 @@
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2019 Juan Linietsky, Ariel Manzur. */
-/* Copyright (c) 2014-2019 Godot Engine contributors (cf. AUTHORS.md) */
+/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
@@ -107,7 +107,11 @@ String ProjectSettings::localize_path(const String &p_path) const {
if (plocal == "") {
return "";
};
- return plocal + path.substr((sep + 1), path.size() - (sep + 1));
+ // Only strip the starting '/' from 'path' if its parent ('plocal') ends with '/'
+ if (plocal[plocal.length() - 1] == '/') {
+ sep += 1;
+ }
+ return plocal + path.substr(sep, path.size() - sep);
};
}
@@ -379,8 +383,16 @@ Error ProjectSettings::_setup(const String &p_path, const String &p_main_pack, b
}
}
- // Attempt with PCK bundled into executable
+#ifdef OSX_ENABLED
+ // Attempt to load PCK from macOS .app bundle resources
+ if (!found) {
+ if (_load_resource_pack(OS::get_singleton()->get_bundle_resource_dir().plus_file(exec_basename + ".pck"))) {
+ found = true;
+ }
+ }
+#endif
+ // Attempt with PCK bundled into executable
if (!found) {
if (_load_resource_pack(exec_path)) {
found = true;
@@ -525,6 +537,8 @@ Error ProjectSettings::_load_settings_binary(const String &p_path) {
set(key, value);
}
+ f->close();
+ memdelete(f);
return OK;
}
@@ -767,10 +781,7 @@ Error ProjectSettings::_save_settings_text(const String &p_file, const Map<Strin
String vstr;
VariantWriter::write_to_string(value, vstr);
- if (F->get().find(" ") != -1)
- file->store_string(F->get().quote() + "=" + vstr + "\n");
- else
- file->store_string(F->get() + "=" + vstr + "\n");
+ file->store_string(F->get().property_name_encode() + "=" + vstr + "\n");
}
}