Merge pull request #55303 from aaronfranke/ps-wait-modified

This commit is contained in:
Rémi Verschelde 2021-11-25 11:21:24 +01:00 committed by GitHub
commit 4261fb3244
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 39 additions and 51 deletions

View file

@ -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 = get("application/config/features");
// 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 = get("rendering/quality/driver/driver_name");
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("application/config/features", project_features);
Set<_VCSort> vclist;
if (p_merge_with_current) {

View file

@ -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();

View file

@ -1233,46 +1233,6 @@ ProjectList::Item ProjectList::load_project_data(const String &p_property_key, b
const String main_scene = cf->get_value("application", "run/main_scene", "");
PackedStringArray project_features = cf->get_value("application", "config/features", PackedStringArray());
bool project_features_dirty = false;
// If there is no feature list currently present, force one to generate.
if (project_features.is_empty()) {
project_features = ProjectSettings::get_required_features();
project_features_dirty = true;
}
// Check the rendering API.
const String rendering_api = cf->get_value("rendering", "quality/driver/driver_name", "");
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);
project_features_dirty = true;
}
}
// Check for the existence of a csproj file.
if (FileAccess::exists(path.plus_file(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#");
project_features_dirty = true;
}
} 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_dirty = true;
}
}
if (project_features_dirty) {
project_features.sort();
// Write the updated feature list, but only if the project config version is the same.
// Never write to project files with a different config version!
if (config_version == ProjectSettings::CONFIG_VERSION) {
ProjectSettings *ps = ProjectSettings::get_singleton();
ps->load_custom(conf);
ps->set("application/config/features", project_features);
ps->save_custom(conf);
}
}
PackedStringArray unsupported_features = ProjectSettings::get_unsupported_features(project_features);
uint64_t last_edited = 0;
@ -1470,7 +1430,7 @@ void ProjectList::create_project_item_control(int p_index) {
int length = unsupported_features_str.length();
if (length > 0) {
Label *unsupported_label = memnew(Label(unsupported_features_str));
unsupported_label->set_custom_minimum_size(Size2(length * 15, 10));
unsupported_label->set_custom_minimum_size(Size2(length * 15, 10) * EDSCALE);
unsupported_label->add_theme_font_override("font", get_theme_font(SNAME("title"), SNAME("EditorFonts")));
unsupported_label->add_theme_color_override("font_color", get_theme_color(SNAME("warning_color"), SNAME("Editor")));
unsupported_label->set_clip_text(true);

View file

@ -788,11 +788,7 @@ bool CSharpLanguage::is_assembly_reloading_needed() {
GDMonoAssembly *proj_assembly = gdmono->get_project_assembly();
String appname = ProjectSettings::get_singleton()->get("application/config/name");
String appname_safe = OS::get_singleton()->get_safe_dir_name(appname);
if (appname_safe.is_empty()) {
appname_safe = "UnnamedProject";
}
String appname_safe = ProjectSettings::get_singleton()->get_safe_project_name();
appname_safe += ".dll";