From e8bd9b21b552aaba2d6156ee4ac8853a4cccf507 Mon Sep 17 00:00:00 2001 From: Veronica Berglyd Olsen <1619840+vkbo@users.noreply.github.com> Date: Sat, 20 Apr 2024 21:31:04 +0200 Subject: [PATCH] Explicitly set python exec and ignore errors from run from source blocks in main --- novelwriter/__init__.py | 13 +++++-------- setup/macos/build.sh | 2 +- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/novelwriter/__init__.py b/novelwriter/__init__.py index 5866d801..c7ea96b5 100644 --- a/novelwriter/__init__.py +++ b/novelwriter/__init__.py @@ -32,7 +32,7 @@ from typing import TYPE_CHECKING from PyQt5.QtWidgets import QApplication, QErrorMessage from novelwriter.config import Config -from novelwriter.error import exceptionHandler, logException +from novelwriter.error import exceptionHandler from novelwriter.shared import SharedData if TYPE_CHECKING: # pragma: no cover @@ -198,24 +198,21 @@ def main(sysArgs: list | None = None) -> GuiMain | None: # Finish initialising config CONFIG.initConfig(confPath, dataPath) - if CONFIG.osDarwin: + if sys.platform == "darwin": try: from Foundation import NSBundle # type: ignore bundle = NSBundle.mainBundle() info = bundle.localizedInfoDictionary() or bundle.infoDictionary() info["CFBundleName"] = "novelWriter" except Exception: - logger.error("Failed to set application name") - logException() - - elif CONFIG.osWindows: + pass # Quietly ignore error + elif sys.platform == "win32": try: import ctypes appID = f"io.novelwriter.{__version__}" ctypes.windll.shell32.SetCurrentProcessExplicitAppUserModelID(appID) # type: ignore except Exception: - logger.error("Failed to set application name") - logException() + pass # Quietly ignore error # Import GUI (after dependency checks), and launch from novelwriter.guimain import GuiMain diff --git a/setup/macos/build.sh b/setup/macos/build.sh index 15a47a3b..fd6adf5f 100755 --- a/setup/macos/build.sh +++ b/setup/macos/build.sh @@ -139,7 +139,7 @@ echo "Creating entry script ..." cat > novelWriter.app/Contents/MacOS/novelWriter << EOF #!/bin/bash DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" -$DIR/../Resources/bin/python -sE $DIR/../Resources/novelWriter/novelWriter.py \$@ +$DIR/../Resources/bin/python$PYTHON -sE $DIR/../Resources/novelWriter/novelWriter.py \$@ EOF # Make it executable