diff --git a/qgis_deployment_toolbelt/profiles/shortcuts.py b/qgis_deployment_toolbelt/profiles/shortcuts.py index 85a283a4..fb8d7a46 100644 --- a/qgis_deployment_toolbelt/profiles/shortcuts.py +++ b/qgis_deployment_toolbelt/profiles/shortcuts.py @@ -45,9 +45,12 @@ # logs logger = logging.getLogger(__name__) + # ############################################################################# # ########## Classes ############### # ################################## + + class ApplicationShortcut: def __init__( self, @@ -87,7 +90,32 @@ def __init__( if isinstance(exec_path, (str, Path)): self.exec_path = Path(exec_path) if not self.exec_path.exists(): - logger.warning(f"Executable does not exist: {self.exec_path}") + # helper to handle common typo error on executable name on Windows + if ( + self.exec_path.name.endswith("qgis-bin.exe") + and self.exec_path.with_name("qgis-ltr-bin.exe").exists() + ): + logger.warning( + f"Executable set does not exist: {self.exec_path} " + f"but {self.exec_path.with_name('qgis-ltr-bin.exe')} does, so " + "this one will be used instead. Check and fix your scenario." + ) + self.exec_path = self.exec_path.with_name("qgis-ltr-bin.exe") + elif ( + self.exec_path.name.endswith("qgis-ltr-bin.exe") + and self.exec_path.with_name("qgis-bin.exe").exists() + ): + logger.warning( + f"Executable set does not exist: {self.exec_path} " + f"but {self.exec_path.with_name('qgis-bin.exe')} does, so " + "this one will be used instead. Check and fix your scenario." + ) + self.exec_path = self.exec_path.with_name("qgis-bin.exe") + else: + logger.warning( + f"Executable does not exist: {self.exec_path}. " + "Shortcuts might not work. Check and fix your scenario." + ) else: raise TypeError( f"exec_path must be a string or pathlib.Path, not {type(exec_path)}"