aboutsummaryrefslogtreecommitdiff
path: root/butl
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2016-08-20 11:29:37 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2016-08-20 11:29:37 +0200
commit84e85fafdf34c0265c4d994b1b1a254446efa5c8 (patch)
treead6beabab7607fee76ff8cfa7224fc9cd4b2ed83 /butl
parent6aada88dc77a95a7b2726c39e008d4ddcd38d58c (diff)
Add .exe extension to commands with directories
Diffstat (limited to 'butl')
-rw-r--r--butl/process.cxx15
1 files 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.
//