From: <mie...@us...> - 2012-02-03 01:40:45
|
Revision: 7462 http://oorexx.svn.sourceforge.net/oorexx/?rev=7462&view=rev Author: miesfeld Date: 2012-02-03 01:40:39 +0000 (Fri, 03 Feb 2012) Log Message: ----------- 3482638 - SysFileTree returns too many files for '*.' mask Modified Paths: -------------- main/trunk/extensions/rexxutil/platform/windows/rexxutil.cpp Modified: main/trunk/extensions/rexxutil/platform/windows/rexxutil.cpp =================================================================== --- main/trunk/extensions/rexxutil/platform/windows/rexxutil.cpp 2012-01-28 21:11:35 UTC (rev 7461) +++ main/trunk/extensions/rexxutil/platform/windows/rexxutil.cpp 2012-02-03 01:40:39 UTC (rev 7462) @@ -2109,7 +2109,7 @@ /* zero terminate, RXVALIDSTRING() guarentees strlength is not 0. */ FileSpec[args[0].strlength] = 0x00; - // If FileSpec ends in \ then append *.* * + // If FileSpec ends in \ then append *.* if (FileSpec[args[0].strlength-1] == '\\') { strcat(FileSpec, "*.*"); @@ -2117,19 +2117,19 @@ else if (FileSpec[args[0].strlength-1] == '.') { // when '.' or '..' are used as directory specifiers append wildcard '\*.*' - if ( (args[0].strlength > 1) && FileSpec[args[0].strlength-2] != '\\' && FileSpec[args[0].strlength-2] != '.' ) + + // There is also the case where the '.' is not used as a directory + // specifier, but rather is tacked on to the end of a file name. Windows has + // a sometimes used convention that a '.' at the end of a file name can be + // used to indicate the file has no extension. For example, given a file + // named: MyFile a command of dir MyFile. will produce a listing of MyFile. + // In this case we want to leave the mask alone. A command of dir *. will + // produce a directory listing of all files that do not have an extension. + if ( args[0].strlength == 1 || (args[0].strlength > 1 && + (FileSpec[args[0].strlength-2] == '\\' || FileSpec[args[0].strlength-2] == '.')) ) { - // The '.' is not used as a directory specifier, but rather is tacked on - // to the end of a file name. Windows has a sometimes used convention that - // a '.' at the end of a file name can be used to indicate the file has - // no extension. For example, given a file named: MyFile a command of - // dir MyFile. will produce a listing of MyFile Just remove the '.' - FileSpec[args[0].strlength-1] = '\0'; + strcat(FileSpec, "\\*.*"); } - else - { - strcat(FileSpec, "\\*.*"); - } } if (numargs >= 3 && /* check third option */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |