From ff51cf8e51d60bfe5c3b00457b4eccfac7bf822a Mon Sep 17 00:00:00 2001 From: Emiliano Vavassori Date: Fri, 8 Apr 2022 01:28:18 +0200 Subject: [PATCH] Cambio logica per trovare il binaryname. --- loaih/__init__.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/loaih/__init__.py b/loaih/__init__.py index 65ecdef..e3fe8e7 100644 --- a/loaih/__init__.py +++ b/loaih/__init__.py @@ -239,8 +239,16 @@ class Build(object): subprocess.run(shlex.split("find . -name '*startcenter.png' -path '*hicolor*48x48*' -exec cp {} . \;"), cwd=self.appimagedir) # Find the name of the binary called in the desktop file. - binary_exec = subprocess.run(shlex.split("awk 'BEGIN { FS = \"=\" } /^Exec/ { print $2; exit }' startcenter.desktop | awk '{ print $1 }'"), cwd=self.appimagedir, text=True, encoding='utf-8') - binaryname = binary_exec.stdout.strip("\n") + binaryname = '' + with open(os.path.join(self.appimagedir, 'startcenter.desktop'), 'r') as d: + a = d.readlines() + for line in a: + if re.match(r'^Exec', line): + binaryname = line.split('=')[-1].split(' ')[0] + # Esci al primo match + break + #binary_exec = subprocess.run(shlex.split(r"awk 'BEGIN { FS = \"=\" } /^Exec/ { print $2; exit }' startcenter.desktop | awk '{ print $1 }'"), cwd=self.appimagedir, text=True, encoding='utf-8') + #binaryname = binary_exec.stdout.strip("\n") bindir=os.path.join(self.appimagedir, 'usr', 'bin') os.makedirs(bindir, exist_ok = True)