From e38fcbe3038ced105ad9ac3d9650730c23cff10f Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Fri, 8 Jul 2016 12:38:35 +0000 Subject: (cherry-pick): Bugfix [5d7ea04580]. Treat .cmd and .ps1 files are executable on Windows. --- doc/file.n | 4 +++- win/tclWinFile.c | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/doc/file.n b/doc/file.n index 36eae79..43eae7a 100644 --- a/doc/file.n +++ b/doc/file.n @@ -156,7 +156,9 @@ returns \fB/home\fR (or something similar). \fBfile executable \fIname\fR . Returns \fB1\fR if file \fIname\fR is executable by the current user, -\fB0\fR otherwise. +\fB0\fR otherwise. On Windows, which does not have an executable attribute, +the command treats all directories and any files with extensions +\fBexe\fR, \fBcom\fR, \fBcmd\fR, \fBbat\fR or \fBps1\fR as executable. .TP \fBfile exists \fIname\fR . diff --git a/win/tclWinFile.c b/win/tclWinFile.c index 41de4a8..e671058 100755 --- a/win/tclWinFile.c +++ b/win/tclWinFile.c @@ -1783,7 +1783,7 @@ NativeAccess( * NativeIsExec -- * * Determines if a path is executable. On windows this is simply defined - * by whether the path ends in any of ".exe", ".com", or ".bat" + * by whether the path ends in a standard executable extension. * * Results: * 1 = executable, 0 = not. @@ -1834,6 +1834,8 @@ NativeIsExec( if ((strcasecmp(p, "exe") == 0) || (strcasecmp(p, "com") == 0) + || (strcasecmp(p, "cmd") == 0) + || (strcasecmp(p, "ps1") == 0) || (strcasecmp(p, "bat") == 0)) { /* * File that ends with .exe, .com, or .bat is executable. -- cgit v0.12