From 6e1d9e9516f24209cbe3fb98e4423991195dc283 Mon Sep 17 00:00:00 2001 From: Nek-12 Date: Thu, 16 Jul 2020 19:48:53 +0300 Subject: [PATCH] Fixed the error which caused wrong bahavior of app launcher patcherin the cleaner.py, updated to comply with new location and launcher script --- cleaner.py | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/cleaner.py b/cleaner.py index 146407c..8580586 100644 --- a/cleaner.py +++ b/cleaner.py @@ -57,15 +57,23 @@ try: f' * {os.path.join(filepath, "app.asar.bak")} was not found: step skipped.') if sys.platform == 'linux' and 'microsoft' not in platform.uname()[3].lower(): - bin_path = '/usr/bin/notion-app' if os.path.exists( - '/usr/bin/notion-app') else '/usr/bin/notion' - with open(bin_path, 'r', encoding='UTF-8') as launcher: - if 'app.asar' not in launcher: + path = '' + if os.path.exists('/opt/notion-app/notion-app'): + path = '/opt/notion-app/notion-app' + elif os.path.exists('/usr/bin/notion-app'): + path = '/usr/bin/notion-app' + elif os.path.exists('/usr/bin/notion'): + path = '/usr/bin/notion' + else: + raise ValueError("Couldn't find the app launcher") + with open(path, 'r', encoding='UTF-8') as launcher: + contents = launcher.read() + if 'app.asar' not in contents: print( f' ...patching app launcher') subprocess.call( - ['sed', '-i', r's/electron\ app/electron\ app\.asar/', - bin_path]) + ['sed', '-i', r's/electron6\ app/electron6\ app\.asar/', + path]) print(f'\n{bold}>>> SUCCESSFULLY CLEANED <<<{normal}')