From 860e8012738e3698a49f6edb8bc0a23bd06f3a51 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Erik=20Bj=C3=A4reholt?= Date: Thu, 24 Mar 2022 13:38:43 +0100 Subject: [PATCH 1/3] fix: detect .bat and .cmd executables on Windows --- aw_qt/manager.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/aw_qt/manager.py b/aw_qt/manager.py index f29e0ca..db9715a 100644 --- a/aw_qt/manager.py +++ b/aw_qt/manager.py @@ -29,7 +29,11 @@ def is_executable(path: str, filename: str) -> bool: return False # On windows all files ending with .exe 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 @@ -63,10 +67,10 @@ def _filename_to_name(filename: str) -> str: 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)) From db7c37e60f516917b755a53b7ebc3591081ca9fc Mon Sep 17 00:00:00 2001 From: Bob Date: Mon, 16 Mar 2026 12:39:06 +0000 Subject: [PATCH 2/3] fix(manager): strip .bat and .cmd extensions on Windows --- aw_qt/manager.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/aw_qt/manager.py b/aw_qt/manager.py index db9715a..e3e4aec 100644 --- a/aw_qt/manager.py +++ b/aw_qt/manager.py @@ -63,7 +63,11 @@ 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"]: From ad72f816f7360d96419e60bcaa7f3932830cdea4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Erik=20Bj=C3=A4reholt?= Date: Mon, 16 Mar 2026 14:01:24 +0100 Subject: [PATCH 3/3] Apply suggestions from code review Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com> --- aw_qt/manager.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/aw_qt/manager.py b/aw_qt/manager.py index e3e4aec..b8c56a7 100644 --- a/aw_qt/manager.py +++ b/aw_qt/manager.py @@ -27,7 +27,7 @@ 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")