From 84e85fafdf34c0265c4d994b1b1a254446efa5c8 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Sat, 20 Aug 2016 11:29:37 +0200 Subject: Add .exe extension to commands with directories --- butl/process.cxx | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/butl/process.cxx b/butl/process.cxx index 75e8718..80b97cc 100644 --- a/butl/process.cxx +++ b/butl/process.cxx @@ -486,10 +486,21 @@ namespace butl // Do PATH search. // if (file.simple ()) + { file = path_search (file); - if (file.empty ()) - fail ("file not found"); + if (file.empty ()) + fail ("file not found"); + } + else + { + // Unless there is already the .exe extension, add it. See path_search() + // for details. + // + const char* e (file.extension ()); + if (e == nullptr || casecmp (e, "exe") != 0) + file += ".exe"; + } // Serialize the arguments to string. // -- cgit v1.1