mirror of
https://github.com/FAUSheppy/homelab_gamevault
synced 2025-12-05 22:51:34 +01:00
Compare commits
2 Commits
d2fdc44eef
...
f2b2dd3589
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f2b2dd3589 | ||
|
|
2b701825b3 |
2
.github/workflows/server.yaml
vendored
2
.github/workflows/server.yaml
vendored
@@ -28,7 +28,7 @@ jobs:
|
||||
username: ${{ secrets.REGISTRY_USER }}
|
||||
password: ${{ secrets.REGISTRY_PASS }}
|
||||
-
|
||||
name: Build and push async-icinga image
|
||||
name: Build and push gamevault server
|
||||
uses: docker/build-push-action@v3
|
||||
with:
|
||||
context: server
|
||||
|
||||
@@ -4,6 +4,7 @@ import customtkinter
|
||||
import imagetools
|
||||
import os
|
||||
import statekeeper
|
||||
import localaction
|
||||
|
||||
def show_large_picture(app, path):
|
||||
'''Show a full-window version of the clicked picture'''
|
||||
@@ -159,7 +160,8 @@ def create_details_page(app, software, backswitch_function, infowidget_window):
|
||||
# install button #
|
||||
print(software.run_exe)
|
||||
print(os.path.join(software.backend.install_dir, software.run_exe or ""))
|
||||
if not software.run_exe or not (os.path.isfile(software.run_exe)
|
||||
if not software.run_exe or not (os.path.isfile(software.run_exe)
|
||||
or localaction.check_substitute_path_exists(software.run_exe)
|
||||
or os.path.isfile(os.path.join(software.backend.install_dir, software.title, software.run_exe))):
|
||||
run_button.configure(state=tkinter.DISABLED)
|
||||
run_button.configure(fg_color="gray")
|
||||
|
||||
@@ -2,6 +2,8 @@ import subprocess
|
||||
import sys
|
||||
import os
|
||||
import json
|
||||
import win32com.client
|
||||
import pythoncom
|
||||
|
||||
# windows imports #
|
||||
if os.name == "nt":
|
||||
@@ -43,6 +45,19 @@ def resolve_lnk(lnk_file_path):
|
||||
else:
|
||||
return lnk_file_path # not required on linux
|
||||
|
||||
def substitute_win_paths(path):
|
||||
|
||||
pythoncom.CoInitialize()
|
||||
shell = win32com.client.Dispatch("WScript.Shell")
|
||||
common_programs = shell.SpecialFolders("AllUsersPrograms")
|
||||
path = path.replace("%ProgramData%", common_programs)
|
||||
return path
|
||||
|
||||
def check_substitute_path_exists(path):
|
||||
|
||||
if "%" in path:
|
||||
return os.path.isfile(substitute_win_paths(path))
|
||||
|
||||
def run_exe(path, synchronous=False):
|
||||
'''Launches a given software'''
|
||||
|
||||
@@ -65,13 +80,23 @@ def run_exe(path, synchronous=False):
|
||||
if synchronous:
|
||||
raise NotImplementedError("SYNC not yet implemented")
|
||||
|
||||
print("Raw paths:", paths)
|
||||
|
||||
# substitute program data #
|
||||
paths = [ substitute_win_paths(p) for p in paths ]
|
||||
|
||||
# substituted paths #
|
||||
print("Subs paths:", paths)
|
||||
|
||||
# resolve links #
|
||||
paths = [resolve_lnk(p) if p.endswith(".lnk") else p for p in paths]
|
||||
|
||||
print("Executing:", paths)
|
||||
print("Executing prepared:", paths)
|
||||
|
||||
try:
|
||||
if paths[0].endswith(".reg"):
|
||||
raise OSError("WinError 740")
|
||||
path = paths[0].replace("\\\\", "\\")
|
||||
subprocess.Popen(path, cwd=os.path.dirname(paths[0])) # TODO fix this BS
|
||||
except OSError as e:
|
||||
if "WinError 740" in str(e):
|
||||
|
||||
@@ -184,8 +184,10 @@ class Software:
|
||||
s.install()
|
||||
|
||||
# run installer if set #
|
||||
print("self.installer", self.installer)
|
||||
if self.installer:
|
||||
installer_path = os.path.join(self.backend.install_dir, self.title, self.installer)
|
||||
print("installer path in if", installer_path)
|
||||
if os.name != "nt" and not os.path.isabs(installer_path):
|
||||
# need abs path for wine #
|
||||
installer_path = os.path.join(os.getcwd(), installer_path)
|
||||
@@ -228,6 +230,9 @@ class Software:
|
||||
|
||||
if self.run_exe:
|
||||
if os.name == "nt" or not ".lnk" in self.run_exe:
|
||||
localaction.run_exe(os.path.join(self.backend.install_dir, self.title, self.run_exe))
|
||||
if self.run_exe.startswith("%") or self.run_exe[1] == ":":
|
||||
localaction.run_exe(self.run_exe)
|
||||
else:
|
||||
localaction.run_exe(os.path.join(self.backend.install_dir, self.title, self.run_exe))
|
||||
else:
|
||||
localaction.run_exe(self.run_exe)
|
||||
|
||||
Reference in New Issue
Block a user