main.py aktualisiert
This commit is contained in:
parent
eafe1d4556
commit
689a2a8427
7
main.py
7
main.py
|
|
@ -6,9 +6,6 @@ import subprocess
|
||||||
import shutil
|
import shutil
|
||||||
|
|
||||||
def resource_path(relative_path: str) -> str:
|
def resource_path(relative_path: str) -> str:
|
||||||
"""
|
|
||||||
Get absolute path to resource, works for dev and for PyInstaller bundle.
|
|
||||||
"""
|
|
||||||
if hasattr(sys, "_MEIPASS"):
|
if hasattr(sys, "_MEIPASS"):
|
||||||
return os.path.join(sys._MEIPASS, relative_path)
|
return os.path.join(sys._MEIPASS, relative_path)
|
||||||
return os.path.join(os.path.abspath("."), relative_path)
|
return os.path.join(os.path.abspath("."), relative_path)
|
||||||
|
|
@ -34,8 +31,7 @@ def extract_and_run():
|
||||||
if not os.path.isfile(exe_path):
|
if not os.path.isfile(exe_path):
|
||||||
print("app.exe not found inside extracted payload!")
|
print("app.exe not found inside extracted payload!")
|
||||||
return 2
|
return 2
|
||||||
|
#run
|
||||||
# Run the extracted executable
|
|
||||||
process = subprocess.Popen(
|
process = subprocess.Popen(
|
||||||
[exe_path],
|
[exe_path],
|
||||||
cwd=temp_dir,
|
cwd=temp_dir,
|
||||||
|
|
@ -46,7 +42,6 @@ def extract_and_run():
|
||||||
return process.returncode
|
return process.returncode
|
||||||
|
|
||||||
finally:
|
finally:
|
||||||
# Cleanup after execution
|
|
||||||
try:
|
try:
|
||||||
shutil.rmtree(temp_dir, ignore_errors=True)
|
shutil.rmtree(temp_dir, ignore_errors=True)
|
||||||
except Exception:
|
except Exception:
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user