Skip to content

Commit

Permalink
cx_Freeze uses splitext, which doesn't work for gst-launch-1.0.exe
Browse files Browse the repository at this point in the history
or with gst-inspect-1.0.exe
  • Loading branch information
totaam committed Mar 22, 2024
1 parent 9f21267 commit 1799bb0
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions packaging/MSWindows/tools/lib_delegate.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,21 @@ def main(argv=()) -> int:
# add `Xpra/` and `Xpra/lib` to the %PATH%
# then call the real EXE:
app_dir, exe_name = os.path.split(argv[0])
if not exe_name.lower().endswith(".exe"):
exe_name += ".exe"
exe_name = os.path.normcase(exe_name)
if exe_name.lower().endswith(".exe"):
exe_name = exe_name[:-4]
lib_dir = os.path.join(app_dir, "lib")
paths = os.environ.get("PATH", "").split(os.pathsep)
for d in (lib_dir, app_dir):
if d not in paths:
paths.append(d)
env = os.environ.copy()
env["PATH"] = os.pathsep.join(paths)
actual_exe = os.path.join(lib_dir, exe_name)
# try harder to find the matching executable file:
for ext in (".exe", "-1.0.exe", ""):
actual_exe = os.path.join(lib_dir, f"{exe_name}{ext}")
if os.path.exists(actual_exe):
break
from subprocess import run
args = [actual_exe] + list(argv[1:])
return run(args, stdin=None, stdout=sys.stdout, stderr=sys.stderr, shell=False, env=env).returncode
Expand Down

0 comments on commit 1799bb0

Please sign in to comment.