Skip to content

Commit c30fa60

Browse files
committed
fix: Windows needs .exe suffix for xlings and ninja binary paths
cfg.xlingsBinary was set to "registry/bin/xlings" without .exe, causing cmd.exe to fail with "not recognized as an internal or external command". Also fix ninja marker check.
1 parent 70360ec commit c30fa60

2 files changed

Lines changed: 8 additions & 0 deletions

File tree

src/config.cppm

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -441,7 +441,11 @@ std::expected<GlobalConfig, ConfigError> load_or_init(
441441
// <XLINGS_HOME>/bin/xlings, which satisfies xlings's own shim-
442442
// creation guard (`if fs::exists(homeDir/"bin"/"xlings")`),
443443
// making ensure_sandbox_xlings_binary() a no-op.
444+
#if defined(_WIN32)
445+
cfg.xlingsBinary = cfg.registryDir / "bin" / "xlings.exe";
446+
#else
444447
cfg.xlingsBinary = cfg.registryDir / "bin" / "xlings";
448+
#endif
445449
cfg.bmiCacheDir = cfg.mcppHome / "bmi";
446450
cfg.metaCacheDir = cfg.mcppHome / "cache";
447451
cfg.logDir = cfg.mcppHome / "log";

src/xlings.cppm

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -834,7 +834,11 @@ void ensure_ninja(const Env& env, bool quiet,
834834
if (std::filesystem::exists(root)) {
835835
std::error_code ec;
836836
for (auto& v : std::filesystem::directory_iterator(root, ec)) {
837+
#if defined(_WIN32)
838+
if (std::filesystem::exists(v.path() / "ninja.exe")) return;
839+
#else
837840
if (std::filesystem::exists(v.path() / "ninja")) return;
841+
#endif
838842
}
839843
}
840844
if (!quiet)

0 commit comments

Comments
 (0)