Point O3DE's engine-path resolution at the read-only engine root

With the non-editable o3de install, the package lives in the per-user venv,
so manifest.get_this_engine_path() (which walks up from the package __file__)
resolved into the venv and engine.json wasn't found -> "Failed to get engine
info" / "Failed to initialize". O3DE has a built-in override for this
immutable-install case: when SNAP and SNAP_BUILD are set, get_this_engine_path
returns "$SNAP/$SNAP_BUILD". The wrapper now sets them to the engine root.

Verified by launching with these vars set: the Project Manager opens with no
engine.json errors.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-06-16 03:43:59 +02:00
parent d83526cbf0
commit 280238bbd7
+15
View File
@@ -37,6 +37,21 @@ export LD_LIBRARY_PATH="$(dirname "$O3DE_BIN"):${LD_LIBRARY_PATH}"
PYTHON_SH=$(find "$O3DE_ROOT" -type f -path '*/python/python.sh' 2>/dev/null | head -n 1)
GET_PYTHON=$(find "$O3DE_ROOT" -type f -path '*/python/get_python.sh' 2>/dev/null | head -n 1)
if [ -n "$GET_PYTHON" ]; then
ENGINE_ROOT=$(dirname "$(dirname "$GET_PYTHON")")
# O3DE's Python derives the engine path from the o3de package's __file__. That
# breaks with our non-editable install (the package lives in the per-user venv,
# not the engine tree), so engine.json is looked for under the venv and not
# found ("Failed to get engine info"). O3DE has a built-in override for exactly
# this immutable-install case: if SNAP and SNAP_BUILD are set, manifest.py's
# get_this_engine_path() returns "$SNAP/$SNAP_BUILD". Point them at the engine
# root. (Verified nothing else in O3DE - Python or the C++ binaries - reads
# these two vars, so there are no snap-specific side effects.)
SNAP=$(dirname "$ENGINE_ROOT")
SNAP_BUILD=$(basename "$ENGINE_ROOT")
export SNAP SNAP_BUILD
# Bootstrap the per-user Python venv if needed (the GUI doesn't do it itself).
if ! "$PYTHON_SH" --version >/dev/null 2>&1; then
echo "O3DE: setting up the per-user Python environment." >&2
echo "O3DE: first launch downloads Python and can take several minutes..." >&2