Skip to content

bug: dart.EXE.exe double extension on Windows #6092

@dukguru

Description

@dukguru

Bug Description

When running flet build windows -v on Windows, the build fails with a "command not found" error because the Dart executable path has .exe extension added twice, resulting in dart.EXE.exe.

Environment

  • OS: Windows 11 (Version 10.0.26200.7628)
  • Flet version: 0.80.4
  • Flet-CLI version: 0.80.4
  • Flutter version: 3.38.8 (Channel stable)
  • Python version: 3.10+

Root Cause

In flet_cli/commands/flutter_base.py, the find_flutter_batch() method uses shutil.which() to find the Dart executable on Windows. This function returns the full path with .EXE extension (uppercase).

Steps to Reproduce

  1. Install Flet on Windows 11
  2. Run flet build windows -v
  3. Observe the error during native assets compilation

Proposed Fix

In flet_cli/commands/flutter_base.py, modify the find_flutter_batch() method to strip the .exe extension on Windows:

def find_flutter_batch(self, exe_filename: str):
    assert self.required_flutter_version
    install_dir = get_flutter_dir(str(self.required_flutter_version))
    ext = ".bat" if is_windows() else ""
    batch_path = os.path.join(install_dir, "bin", f"{exe_filename}{ext}")
    if os.path.exists(batch_path):
        return batch_path

    batch_path = shutil.which(exe_filename)
    if not batch_path:
        return None
    if is_windows() and batch_path.endswith(".file"):
        return batch_path.replace(".file", ".bat")
    # Remove .exe/.EXE extension on Windows if present (Flutter adds it back)
    if is_windows() and batch_path.lower().endswith(".exe"):
        return batch_path[:-4]
    return batch_path

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingplatform: windowsSpecific to Windows OS

Type

No type

Projects

Status

✅ Done

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions