Merge pull request #12443 from mhilbrunner/appnoname

Mono: Use "UnnamedProject" if "application/config/name" is empty
This commit is contained in:
Rémi Verschelde 2017-10-28 11:35:15 +02:00 committed by GitHub
commit 87dbb716d9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 24 additions and 7 deletions

View file

@ -488,13 +488,17 @@ void CSharpLanguage::reload_assemblies_if_needed(bool p_soft_reload) {
GDMonoAssembly *proj_assembly = gdmono->get_project_assembly();
String name = ProjectSettings::get_singleton()->get("application/config/name");
if (name.empty()) {
name = "UnnamedProject";
}
if (proj_assembly) {
String proj_asm_path = proj_assembly->get_path();
if (!FileAccess::exists(proj_assembly->get_path())) {
// Maybe it wasn't loaded from the default path, so check this as well
String proj_asm_name = ProjectSettings::get_singleton()->get("application/config/name");
proj_asm_path = GodotSharpDirs::get_res_temp_assemblies_dir().plus_file(proj_asm_name);
proj_asm_path = GodotSharpDirs::get_res_temp_assemblies_dir().plus_file(name);
if (!FileAccess::exists(proj_asm_path))
return; // No assembly to load
}
@ -502,8 +506,7 @@ void CSharpLanguage::reload_assemblies_if_needed(bool p_soft_reload) {
if (FileAccess::get_modified_time(proj_asm_path) <= proj_assembly->get_modified_time())
return; // Already up to date
} else {
String proj_asm_name = ProjectSettings::get_singleton()->get("application/config/name");
if (!FileAccess::exists(GodotSharpDirs::get_res_temp_assemblies_dir().plus_file(proj_asm_name)))
if (!FileAccess::exists(GodotSharpDirs::get_res_temp_assemblies_dir().plus_file(name)))
return; // No assembly to load
}
}

View file

@ -71,6 +71,10 @@ bool GodotSharpEditor::_create_project_solution() {
String path = OS::get_singleton()->get_resource_dir();
String name = ProjectSettings::get_singleton()->get("application/config/name");
if (name.empty()) {
name = "UnnamedProject";
}
String guid = CSharpProject::generate_game_project(path, name);
if (guid.length()) {

View file

@ -122,7 +122,14 @@ private:
#ifdef TOOLS_ENABLED
mono_solutions_dir = mono_user_dir.plus_file("solutions");
build_logs_dir = mono_user_dir.plus_file("build_logs");
String base_path = String("res://") + ProjectSettings::get_singleton()->get("application/config/name");
String name = ProjectSettings::get_singleton()->get("application/config/name");
if (name.empty()) {
name = "UnnamedProject";
}
String base_path = String("res://") + name;
sln_filepath = ProjectSettings::get_singleton()->globalize_path(base_path + ".sln");
csproj_filepath = ProjectSettings::get_singleton()->globalize_path(base_path + ".csproj");
#endif

View file

@ -369,9 +369,12 @@ bool GDMono::_load_project_assembly() {
if (project_assembly)
return true;
String project_assembly_name = ProjectSettings::get_singleton()->get("application/config/name");
String name = ProjectSettings::get_singleton()->get("application/config/name");
if (name.empty()) {
name = "UnnamedProject";
}
bool success = _load_assembly(project_assembly_name, &project_assembly);
bool success = _load_assembly(name, &project_assembly);
if (success)
mono_assembly_set_main(project_assembly->get_assembly());