core.utils.runtime_launcher

File:

EuljiroWorship/core/utils/runtime_launcher.py

Author:

Benjamin Jaedon Choi - https://github.com/saintbenjamin

Affiliated Church:

The Eulji-ro Presbyterian Church

Address:

The Eulji-ro Presbyterian Church, 24-10, Eulji-ro 20-gil, Jung-gu, Seoul 04549, South Korea

Telephone:

+82-2-2266-3070

E-mail:

euljirochurch [at] G.M.A.I.L. (replace [at] with @ and G.M.A.I.L as you understood.)

License:

MIT License with Attribution Requirement (see LICENSE file for details); Copyright (c) 2025 The Eulji-ro Presbyterian Church.

Runtime helpers for source and frozen executable launches.

This module centralizes small helpers used when the application needs to:

  • detect whether it is running from source or from a frozen executable

  • resolve the runtime application root directory

  • relaunch the main entry point in alternate modes (controller/server/helper)

  • normalize the current working directory for relative resource paths

core.utils.runtime_launcher.is_frozen()[source]

Return whether the current process is running as a frozen executable.

Returns:

True if the process is running from a frozen bundle (for example, a PyInstaller build), False otherwise.

Return type:

bool

core.utils.runtime_launcher.get_runtime_base_dir()[source]

Resolve the user-facing application root directory.

Returns:

Runtime root directory.

  • In source execution, this is the repository root.

  • In frozen execution, this is the directory containing the executable file.

Return type:

pathlib.Path

core.utils.runtime_launcher.get_entry_script_path()[source]

Return the source entry script path for non-frozen relaunches.

Returns:

Absolute path to EuljiroWorship.py under the project root.

Return type:

pathlib.Path

core.utils.runtime_launcher.build_entry_command(*args)[source]

Build a subprocess command that relaunches the main application entry point.

This helper keeps subprocess launch behavior consistent between:

  • source execution (python EuljiroWorship.py ...)

  • frozen execution (EuljiroWorship.exe ...)

Parameters:

*args (str) – Additional command-line arguments passed to the relaunched process.

Returns:

Command list suitable for subprocess.Popen.

Return type:

list[str]

core.utils.runtime_launcher.ensure_runtime_cwd()[source]

Change the current working directory to the runtime application root.

This is useful for code paths that still rely on relative resource directories such as ./html or ./assets.

Returns:

The runtime application root directory now used as CWD.

Return type:

pathlib.Path

core.utils.runtime_launcher.set_windows_app_user_model_id(app_id)[source]

Set the Windows AppUserModelID for the current process when available.

This helps Windows display the intended application identity and icon in the taskbar for GUI processes, especially when launching from Python or from a frozen executable that spawns alternate modes.

Parameters:

app_id (str) – Stable Windows application identifier for the current process.

Returns:

None

Return type:

None