summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
Diffstat (limited to 'core')
-rw-r--r--core/config/project_settings.cpp41
-rw-r--r--core/config/project_settings.h1
-rw-r--r--core/error/error_macros.cpp2
-rw-r--r--core/io/logger.cpp2
-rw-r--r--core/object/script_language.cpp2
5 files changed, 40 insertions, 8 deletions
diff --git a/core/config/project_settings.cpp b/core/config/project_settings.cpp
index 21a802cb78..0e15edc29f 100644
--- a/core/config/project_settings.cpp
+++ b/core/config/project_settings.cpp
@@ -65,6 +65,14 @@ String ProjectSettings::get_resource_path() const {
return resource_path;
}
+String ProjectSettings::get_safe_project_name() const {
+ String safe_name = OS::get_singleton()->get_safe_dir_name(get("application/config/name"));
+ if (safe_name.is_empty()) {
+ safe_name = "UnnamedProject";
+ }
+ return safe_name;
+}
+
String ProjectSettings::get_imported_files_path() const {
return get_project_data_path().plus_file("imported");
}
@@ -701,11 +709,6 @@ Error ProjectSettings::_load_settings_text(const String &p_path) {
} else {
if (section == String()) {
set(assign, value);
- } else if (section == "application" && assign == "config/features") {
- const PackedStringArray project_features_untrimmed = value;
- const PackedStringArray project_features = _trim_to_supported_features(project_features_untrimmed);
- set("application/config/features", project_features);
- save();
} else {
set(section + "/" + assign, value);
}
@@ -923,6 +926,34 @@ Error ProjectSettings::_save_custom_bnd(const String &p_file) { // add other par
Error ProjectSettings::save_custom(const String &p_path, const CustomMap &p_custom, const Vector<String> &p_custom_features, bool p_merge_with_current) {
ERR_FAIL_COND_V_MSG(p_path == "", ERR_INVALID_PARAMETER, "Project settings save path cannot be empty.");
+ PackedStringArray project_features = has_setting("application/config/features") ? (PackedStringArray)get_setting("application/config/features") : PackedStringArray();
+ // If there is no feature list currently present, force one to generate.
+ if (project_features.is_empty()) {
+ project_features = ProjectSettings::get_required_features();
+ }
+ // Check the rendering API.
+ const String rendering_api = has_setting("rendering/quality/driver/driver_name") ? (String)get_setting("rendering/quality/driver/driver_name") : String();
+ if (rendering_api != "") {
+ // Add the rendering API as a project feature if it doesn't already exist.
+ if (!project_features.has(rendering_api)) {
+ project_features.append(rendering_api);
+ }
+ }
+ // Check for the existence of a csproj file.
+ if (FileAccess::exists(get_resource_path().plus_file(get_safe_project_name() + ".csproj"))) {
+ // If there is a csproj file, add the C# feature if it doesn't already exist.
+ if (!project_features.has("C#")) {
+ project_features.append("C#");
+ }
+ } else {
+ // If there isn't a csproj file, remove the C# feature if it exists.
+ if (project_features.has("C#")) {
+ project_features.remove_at(project_features.find("C#"));
+ }
+ }
+ project_features = _trim_to_supported_features(project_features);
+ set_setting("application/config/features", project_features);
+
Set<_VCSort> vclist;
if (p_merge_with_current) {
diff --git a/core/config/project_settings.h b/core/config/project_settings.h
index 2d8ec76b7a..5b74356337 100644
--- a/core/config/project_settings.h
+++ b/core/config/project_settings.h
@@ -151,6 +151,7 @@ public:
String get_project_data_dir_name() const;
String get_project_data_path() const;
String get_resource_path() const;
+ String get_safe_project_name() const;
String get_imported_files_path() const;
static ProjectSettings *get_singleton();
diff --git a/core/error/error_macros.cpp b/core/error/error_macros.cpp
index 719ea8afb5..61bb949ed4 100644
--- a/core/error/error_macros.cpp
+++ b/core/error/error_macros.cpp
@@ -76,7 +76,7 @@ void _err_print_error(const char *p_function, const char *p_file, int p_line, co
// Main error printing function.
void _err_print_error(const char *p_function, const char *p_file, int p_line, const char *p_error, const char *p_message, bool p_editor_notify, ErrorHandlerType p_type) {
- OS::get_singleton()->print_error(p_function, p_file, p_line, p_error, p_message, (Logger::ErrorType)p_type);
+ OS::get_singleton()->print_error(p_function, p_file, p_line, p_error, p_message, p_editor_notify, (Logger::ErrorType)p_type);
_global_lock();
ErrorHandlerList *l = error_handler_list;
diff --git a/core/io/logger.cpp b/core/io/logger.cpp
index b68a8b20a5..8a8bdf07d3 100644
--- a/core/io/logger.cpp
+++ b/core/io/logger.cpp
@@ -266,7 +266,7 @@ void CompositeLogger::log_error(const char *p_function, const char *p_file, int
}
for (int i = 0; i < loggers.size(); ++i) {
- loggers[i]->log_error(p_function, p_file, p_line, p_code, p_rationale, p_type);
+ loggers[i]->log_error(p_function, p_file, p_line, p_code, p_rationale, p_editor_notify, p_type);
}
}
diff --git a/core/object/script_language.cpp b/core/object/script_language.cpp
index c2449e3ddc..8ec1a973e7 100644
--- a/core/object/script_language.cpp
+++ b/core/object/script_language.cpp
@@ -511,7 +511,7 @@ void PlaceHolderScriptInstance::update(const List<PropertyInfo> &p_properties, c
Variant defval;
if (script->get_property_default_value(E->key(), defval)) {
//remove because it's the same as the default value
- if (defval == E) {
+ if (defval == E->get()) {
to_remove.push_back(E->key());
}
}