Godot Engine – Multi-platform 2D and 3D game engine
Fix the logic to set the editor `GODOT_EDITOR_CUSTOM_FEATURES` environment variable
Fredia Huya-Kouadiocd9e0c7b9e87
diff --git a/platform/android/java/editor/src/main/java/org/godotengine/editor/BaseGodotEditor.kt b/platform/android/java/editor/src/main/java/org/godotengine/editor/BaseGodotEditor.ktindex e638d26d36a..1b495fd501d 100644--- a/platform/android/java/editor/src/main/java/org/godotengine/editor/BaseGodotEditor.kt+++ b/platform/android/java/editor/src/main/java/org/godotengine/editor/BaseGodotEditor.kt@@ -45,6 +45,7 @@ import android.os.Bundleimport android.os.Debugimport android.os.Environmentimport android.os.Process+import android.system.Osimport android.util.Logimport android.view.Viewimport android.widget.TextView@@ -97,6 +98,7 @@ abstract class BaseGodotEditor : GodotActivity(), GameMenuFragment.GameMenuListeinternal const val EXTRA_GAME_MENU_STATE = "game_menu_state"internal const val EXTRA_IS_GAME_EMBEDDED = "is_game_embedded"internal const val EXTRA_IS_GAME_RUNNING = "is_game_running"+ private const val EXTRA_EDITOR_ENV_VARIABLES = "editor_env_variables"// Benchmarking extras.private const val EXTRA_LOAD_EMPTY_BENCHMARK_PROJECT = "load_empty_benchmark_project"@@ -414,6 +416,14 @@ abstract class BaseGodotEditor : GodotActivity(), GameMenuFragment.GameMenuListe}override fun handleStartIntent(intent: Intent, newLaunch: Boolean) {+ // Apply the passed on environment variables.+ val envVariables = intent.getBundleExtra(EXTRA_EDITOR_ENV_VARIABLES)+ if (envVariables != null && !envVariables.isEmpty) {+ for (env in envVariables.keySet()) {+ Os.setenv(env, envVariables.getString(env), true)+ }+ }+when (intent.action) {Intent.ACTION_VIEW -> {val rootDir = Environment.getExternalStorageDirectory().canonicalPath@@ -769,11 +779,22 @@ abstract class BaseGodotEditor : GodotActivity(), GameMenuFragment.GameMenuListeActivityOptions.makeScaleUpAnimation(sourceView, startX, startY, 0, 0)}+ // Retrieve the environment variables.+ val envVariables = Bundle().apply {+ val customFeatures = Os.getenv("GODOT_EDITOR_CUSTOM_FEATURES")+ if (!customFeatures.isNullOrEmpty()) {+ putString("GODOT_EDITOR_CUSTOM_FEATURES", customFeatures)+ }+ }+val newInstance = getNewGodotInstanceIntent(editorWindowInfo, args)newInstance.apply {putExtra(EXTRA_EDITOR_HINT, godot?.isEditorHint() == true)putExtra(EXTRA_PROJECT_MANAGER_HINT, godot?.isProjectManagerHint() == true)putExtra(EXTRA_GAME_MENU_STATE, gameMenuState)++ // Environment variables are process specific, so we need to pass them to the new process we're starting.+ putExtra(EXTRA_EDITOR_ENV_VARIABLES, envVariables)}if (editorWindowInfo.windowClassName == javaClass.name) {