From ca9f53824153cabd6f7cf69459b76b2abfff52db Mon Sep 17 00:00:00 2001 From: vincentdarley Date: Mon, 17 May 2004 10:38:22 +0000 Subject: fix to case sensitive 'file executable' on Windows --- ChangeLog | 6 ++++++ tests/cmdAH.test | 11 ++++++++++- win/tclWinFile.c | 11 +++++++---- 3 files changed, 23 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 3a9f6bd..7b0287d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2004-05-17 Vince Darley + + * win/tclWinFile.c: + * tests/cmdAH.test: fix to (Bug 954263) where 'file executable' + was case-sensitive. + 2004-05-17 Donal K. Fellows * doc/OpenFileChnl.3: Documented type of 'offset' argument to diff --git a/tests/cmdAH.test b/tests/cmdAH.test index 13bf01d..c66fc82 100644 --- a/tests/cmdAH.test +++ b/tests/cmdAH.test @@ -10,7 +10,7 @@ # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # -# RCS: @(#) $Id: cmdAH.test,v 1.39 2004/04/06 08:45:04 dkf Exp $ +# RCS: @(#) $Id: cmdAH.test,v 1.40 2004/05/17 10:38:22 vincentdarley Exp $ if {[lsearch [namespace children] ::tcltest] == -1} { package require tcltest 2.1 @@ -851,6 +851,15 @@ test cmdAH-18.5 {Tcl_FileObjCmd: executable} {winOnly testchmod} { removeFile $gorpexe set x } {0 1} +test cmdAH-18.5.1 {Tcl_FileObjCmd: executable} {winOnly testchmod} { + # On pc, must be a .exe, .com, etc. + + set x [file exe $gorpfile] + set gorpexe [makeFile foo gorp.exe] + lappend x [file exe [string toupper $gorpexe]] + removeFile $gorpexe + set x +} {0 1} test cmdAH-18.6 {Tcl_FileObjCmd: executable} {testchmod} { # Directories are always executable. diff --git a/win/tclWinFile.c b/win/tclWinFile.c index b7af7d0..14c4995 100644 --- a/win/tclWinFile.c +++ b/win/tclWinFile.c @@ -11,7 +11,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclWinFile.c,v 1.62 2004/04/07 22:04:30 hobbs Exp $ + * RCS: @(#) $Id: tclWinFile.c,v 1.63 2004/05/17 10:38:22 vincentdarley Exp $ */ //#define _WIN32_WINNT 0x0500 @@ -1503,9 +1503,12 @@ NativeIsExec(nativePath) return 0; } - if ((memcmp((char*)(path+len-3),L"exe",3*sizeof(WCHAR)) == 0) - || (memcmp((char*)(path+len-3),L"com",3*sizeof(WCHAR)) == 0) - || (memcmp((char*)(path+len-3),L"bat",3*sizeof(WCHAR)) == 0)) { + /* + * Use wide-char case-insensitive comparison + */ + if ((_wcsicmp(path+len-3,L"exe") == 0) + || (_wcsicmp(path+len-3,L"com") == 0) + || (_wcsicmp(path+len-3,L"bat") == 0)) { return 1; } } else { -- cgit v0.12