1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-05 12:10:55 +00:00

C#: Avoid GodotSharp as project assembly name

The name GodotSharp conflicts with the name of the Godot assembly,
this causes the project assembly to be ignored.
This commit is contained in:
Raul Santos
2023-06-14 20:18:26 +02:00
parent b91d8d49fa
commit 06c0a1abc9
6 changed files with 32 additions and 24 deletions

View File

@@ -208,4 +208,23 @@ String relative_to(const String &p_path, const String &p_relative_to) {
return relative_to_impl(path_abs_norm, relative_to_abs_norm);
}
String get_csharp_project_name() {
String name = GLOBAL_GET("mono/project/assembly_name");
if (name.empty()) {
name = GLOBAL_GET("application/config/name");
name = OS::get_singleton()->get_safe_dir_name(name);
}
if (name.empty()) {
name = "UnnamedProject";
}
// Avoid reserved names that conflict with Godot assemblies.
if (name == "GodotSharp" || name == "GodotSharpEditor") {
name += "_";
}
return name;
}
} // namespace path