mirror of
https://github.com/godotengine/godot.git
synced 2024-11-24 05:04:10 +00:00
Merge pull request #97992 from Nikitf777/android-sdk-path
Add default value of editor property `export/android/android_sdk_path` for Windows, Linux, and macOS
This commit is contained in:
commit
8811b39968
@ -37,6 +37,8 @@
|
|||||||
#include "editor/editor_settings.h"
|
#include "editor/editor_settings.h"
|
||||||
#include "editor/export/editor_export.h"
|
#include "editor/export/editor_export.h"
|
||||||
|
|
||||||
|
String get_default_android_sdk_path();
|
||||||
|
|
||||||
void register_android_exporter_types() {
|
void register_android_exporter_types() {
|
||||||
GDREGISTER_VIRTUAL_CLASS(EditorExportPlatformAndroid);
|
GDREGISTER_VIRTUAL_CLASS(EditorExportPlatformAndroid);
|
||||||
}
|
}
|
||||||
@ -54,8 +56,10 @@ void register_android_exporter() {
|
|||||||
#else
|
#else
|
||||||
EDITOR_DEF_BASIC("export/android/java_sdk_path", OS::get_singleton()->get_environment("JAVA_HOME"));
|
EDITOR_DEF_BASIC("export/android/java_sdk_path", OS::get_singleton()->get_environment("JAVA_HOME"));
|
||||||
EditorSettings::get_singleton()->add_property_hint(PropertyInfo(Variant::STRING, "export/android/java_sdk_path", PROPERTY_HINT_GLOBAL_DIR));
|
EditorSettings::get_singleton()->add_property_hint(PropertyInfo(Variant::STRING, "export/android/java_sdk_path", PROPERTY_HINT_GLOBAL_DIR));
|
||||||
EDITOR_DEF_BASIC("export/android/android_sdk_path", OS::get_singleton()->get_environment("ANDROID_HOME"));
|
|
||||||
|
EDITOR_DEF_BASIC("export/android/android_sdk_path", OS::get_singleton()->has_environment("ANDROID_HOME") ? OS::get_singleton()->get_environment("ANDROID_HOME") : get_default_android_sdk_path());
|
||||||
EditorSettings::get_singleton()->add_property_hint(PropertyInfo(Variant::STRING, "export/android/android_sdk_path", PROPERTY_HINT_GLOBAL_DIR));
|
EditorSettings::get_singleton()->add_property_hint(PropertyInfo(Variant::STRING, "export/android/android_sdk_path", PROPERTY_HINT_GLOBAL_DIR));
|
||||||
|
|
||||||
EDITOR_DEF("export/android/force_system_user", false);
|
EDITOR_DEF("export/android/force_system_user", false);
|
||||||
|
|
||||||
EDITOR_DEF("export/android/shutdown_adb_on_exit", true);
|
EDITOR_DEF("export/android/shutdown_adb_on_exit", true);
|
||||||
@ -69,3 +73,15 @@ void register_android_exporter() {
|
|||||||
Ref<EditorExportPlatformAndroid> exporter = Ref<EditorExportPlatformAndroid>(memnew(EditorExportPlatformAndroid));
|
Ref<EditorExportPlatformAndroid> exporter = Ref<EditorExportPlatformAndroid>(memnew(EditorExportPlatformAndroid));
|
||||||
EditorExport::get_singleton()->add_export_platform(exporter);
|
EditorExport::get_singleton()->add_export_platform(exporter);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline String get_default_android_sdk_path() {
|
||||||
|
#ifdef WINDOWS_ENABLED
|
||||||
|
return OS::get_singleton()->get_environment("LOCALAPPDATA").path_join("Android/Sdk");
|
||||||
|
#elif LINUXBSD_ENABLED
|
||||||
|
return OS::get_singleton()->get_environment("HOME").path_join("Android/Sdk");
|
||||||
|
#elif MACOS_ENABLED
|
||||||
|
return OS::get_singleton()->get_environment("HOME").path_join("Library/Android/sdk");
|
||||||
|
#else
|
||||||
|
return String();
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user