diff --git a/aw_qt/manager.py b/aw_qt/manager.py index f29e0ca..b8c56a7 100644 --- a/aw_qt/manager.py +++ b/aw_qt/manager.py @@ -27,9 +27,13 @@ def _log_modules(modules: List["Module"]) -> None: def is_executable(path: str, filename: str) -> bool: if not os.path.isfile(path): return False - # On windows all files ending with .exe are executables + # On Windows, .exe/.bat/.cmd files are executables if platform.system() == "Windows": - return filename.endswith(".exe") + return ( + filename.endswith(".exe") + or filename.endswith(".bat") + or filename.endswith(".cmd") + ) # On Unix platforms all files having executable permissions are executables # We do not however want to include .desktop files else: # Assumes Unix @@ -59,14 +63,18 @@ def _discover_modules_in_directory(path: str) -> List["Module"]: def _filename_to_name(filename: str) -> str: - return filename.replace(".exe", "") + if platform.system() == "Windows": + for ext in (".exe", ".bat", ".cmd"): + if filename.endswith(ext): + return filename[: -len(ext)] + return filename def _discover_modules_bundled() -> List["Module"]: - """Use ``_discover_modules_in_directory`` to find all bundled modules """ + """Use ``_discover_modules_in_directory`` to find all bundled modules""" search_paths = [_module_dir, _parent_dir] if platform.system() == "Darwin": - macos_dir = os.path.abspath(os.path.join(_parent_dir, os.pardir, 'MacOS')) + macos_dir = os.path.abspath(os.path.join(_parent_dir, os.pardir, "MacOS")) search_paths.append(macos_dir) logger.info("Searching for bundled modules in: {}".format(search_paths))