mirror of
https://github.com/niess/python-appimage.git
synced 2025-07-24 22:31:15 +02:00
20 lines
491 B
Python
20 lines
491 B
Python
# This is a patch to getpath. It must execute before site.main() is called
|
|
def _initappimage():
|
|
"""Initialise executable name when running from an AppImage."""
|
|
import os
|
|
import sys
|
|
|
|
env = os.environ
|
|
try:
|
|
command = env["APPIMAGE_COMMAND"]
|
|
except KeyError:
|
|
return
|
|
|
|
if command and ("APPDIR" in env):
|
|
command = os.path.abspath(command)
|
|
sys.executable = command
|
|
sys._base_executable = command
|
|
|
|
_initappimage()
|
|
del _initappimage
|