MCPcopy Create free account
hub / github.com/Redot-Engine/redot-engine / get_csharp_project_name

Function get_csharp_project_name

modules/mono/utils/path_utils.cpp:242–269  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

240const Vector<String> reserved_assembly_names = { "GodotSharp", "GodotSharpEditor", "Godot.SourceGenerators" };
241
242String get_csharp_project_name() {
243 String name = GLOBAL_GET("dotnet/project/assembly_name");
244 if (name.is_empty()) {
245 name = GLOBAL_GET("application/config/name");
246 Vector<String> invalid_chars = Vector<String>({ //
247 // Windows reserved filename chars.
248 ":", "*", "?", "\"", "<", ">", "|",
249 // Directory separators.
250 "/", "\\",
251 // Other chars that have been found to break assembly loading.
252 ";", "'", "=", "," });
253 name = name.strip_edges();
254 for (int i = 0; i < invalid_chars.size(); i++) {
255 name = name.replace(invalid_chars[i], "-");
256 }
257 }
258
259 if (name.is_empty()) {
260 name = "UnnamedProject";
261 }
262
263 // Avoid reserved names that conflict with Godot assemblies.
264 if (reserved_assembly_names.has(name)) {
265 name += "_";
266 }
267
268 return name;
269}
270
271} // namespace Path

Calls 5

strip_edgesMethod · 0.80
sizeMethod · 0.65
is_emptyMethod · 0.45
replaceMethod · 0.45
hasMethod · 0.45

Tested by

no test coverage detected