C#/netcore: Add base desktop game export implementation

This base implementation is still very barebones but it defines the path
for how exporting will work (at least when embedding the .NET runtime).

Many manual steps are still needed, which should be automatized in the
future. For example, in addition to the API assemblies, now you also
need to copy the GodotPlugins assembly to each game project.
This commit is contained in:
Ignacio Roldán Etcheverry 2021-12-28 23:25:16 +01:00
parent f88d8902cf
commit 88e367a406
51 changed files with 1568 additions and 1224 deletions

View file

@ -51,6 +51,37 @@
namespace path {
String find_executable(const String &p_name) {
#ifdef WINDOWS_ENABLED
Vector<String> exts = OS::get_singleton()->get_environment("PATHEXT").split(ENV_PATH_SEP, false);
#endif
Vector<String> env_path = OS::get_singleton()->get_environment("PATH").split(ENV_PATH_SEP, false);
if (env_path.is_empty()) {
return String();
}
for (int i = 0; i < env_path.size(); i++) {
String p = path::join(env_path[i], p_name);
#ifdef WINDOWS_ENABLED
for (int j = 0; j < exts.size(); j++) {
String p2 = p + exts[j].to_lower(); // lowercase to reduce risk of case mismatch warning
if (FileAccess::exists(p2)) {
return p2;
}
}
#else
if (FileAccess::exists(p)) {
return p;
}
#endif
}
return String();
}
String cwd() {
#ifdef WINDOWS_ENABLED
const DWORD expected_size = ::GetCurrentDirectoryW(0, nullptr);