|
@@ -95,6 +95,38 @@ String _get_mono_user_dir() {
|
|
#endif
|
|
#endif
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+#if !TOOLS_ENABLED
|
|
|
|
+// This should be the equivalent of GodotTools.Utils.OS.PlatformNameMap.
|
|
|
|
+static const char *platform_name_map[][2] = {
|
|
|
|
+ { "Windows", "windows" },
|
|
|
|
+ { "macOS", "macos" },
|
|
|
|
+ { "Linux", "linuxbsd" },
|
|
|
|
+ { "FreeBSD", "linuxbsd" },
|
|
|
|
+ { "NetBSD", "linuxbsd" },
|
|
|
|
+ { "BSD", "linuxbsd" },
|
|
|
|
+ { "UWP", "uwp" },
|
|
|
|
+ { "Haiku", "haiku" },
|
|
|
|
+ { "Android", "android" },
|
|
|
|
+ { "iOS", "ios" },
|
|
|
|
+ { "Web", "web" },
|
|
|
|
+ { nullptr, nullptr }
|
|
|
|
+};
|
|
|
|
+
|
|
|
|
+String _get_platform_name() {
|
|
|
|
+ String platform_name = OS::get_singleton()->get_name();
|
|
|
|
+
|
|
|
|
+ int idx = 0;
|
|
|
|
+ while (platform_name_map[idx][0] != nullptr) {
|
|
|
|
+ if (platform_name_map[idx][0] == platform_name) {
|
|
|
|
+ return platform_name_map[idx][1];
|
|
|
|
+ }
|
|
|
|
+ idx++;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return "";
|
|
|
|
+}
|
|
|
|
+#endif
|
|
|
|
+
|
|
class _GodotSharpDirs {
|
|
class _GodotSharpDirs {
|
|
public:
|
|
public:
|
|
String res_metadata_dir;
|
|
String res_metadata_dir;
|
|
@@ -139,12 +171,13 @@ private:
|
|
#endif
|
|
#endif
|
|
api_assemblies_dir = api_assemblies_base_dir.path_join(GDMono::get_expected_api_build_config());
|
|
api_assemblies_dir = api_assemblies_base_dir.path_join(GDMono::get_expected_api_build_config());
|
|
#else // TOOLS_ENABLED
|
|
#else // TOOLS_ENABLED
|
|
|
|
+ String platform = _get_platform_name();
|
|
String arch = Engine::get_singleton()->get_architecture_name();
|
|
String arch = Engine::get_singleton()->get_architecture_name();
|
|
String appname_safe = path::get_csharp_project_name();
|
|
String appname_safe = path::get_csharp_project_name();
|
|
String packed_path = "res://.godot/mono/publish/" + arch;
|
|
String packed_path = "res://.godot/mono/publish/" + arch;
|
|
if (DirAccess::exists(packed_path)) {
|
|
if (DirAccess::exists(packed_path)) {
|
|
// The dotnet publish data is packed in the pck/zip.
|
|
// The dotnet publish data is packed in the pck/zip.
|
|
- String data_dir_root = OS::get_singleton()->get_cache_path().path_join("data_" + appname_safe + "_" + arch);
|
|
|
|
|
|
+ String data_dir_root = OS::get_singleton()->get_cache_path().path_join("data_" + appname_safe + "_" + platform + "_" + arch);
|
|
bool has_data = false;
|
|
bool has_data = false;
|
|
if (!has_data) {
|
|
if (!has_data) {
|
|
// 1. Try to access the data directly.
|
|
// 1. Try to access the data directly.
|
|
@@ -173,16 +206,10 @@ private:
|
|
api_assemblies_dir = data_dir_root;
|
|
api_assemblies_dir = data_dir_root;
|
|
} else {
|
|
} else {
|
|
// The dotnet publish data is in a directory next to the executable.
|
|
// The dotnet publish data is in a directory next to the executable.
|
|
- String data_dir_root = exe_dir.path_join("data_" + appname_safe + "_" + arch);
|
|
|
|
- if (!DirAccess::exists(data_dir_root)) {
|
|
|
|
- data_dir_root = exe_dir.path_join("data_Godot_" + arch);
|
|
|
|
- }
|
|
|
|
|
|
+ String data_dir_root = exe_dir.path_join("data_" + appname_safe + "_" + platform + "_" + arch);
|
|
#ifdef MACOS_ENABLED
|
|
#ifdef MACOS_ENABLED
|
|
if (!DirAccess::exists(data_dir_root)) {
|
|
if (!DirAccess::exists(data_dir_root)) {
|
|
- data_dir_root = res_dir.path_join("data_" + appname_safe + "_" + arch);
|
|
|
|
- }
|
|
|
|
- if (!DirAccess::exists(data_dir_root)) {
|
|
|
|
- data_dir_root = res_dir.path_join("data_Godot_" + arch);
|
|
|
|
|
|
+ data_dir_root = res_dir.path_join("data_" + appname_safe + "_" + platform + "_" + arch);
|
|
}
|
|
}
|
|
#endif
|
|
#endif
|
|
api_assemblies_dir = data_dir_root;
|
|
api_assemblies_dir = data_dir_root;
|