Tcl Source Code

View Ticket
Login
Ticket UUID: 3002987
Title: new option for [glob] to behave like unix
Type: RFE Created on: 2010-05-17 22:46:04
Submitter: coldstore Assigned to: dkf
Subsystem: 16. Commands A-H Severity:
Priority: 5 Medium Last modified: 2010-05-21 23:49:42
Status: Open Closed by:
Resolution: None Closed on:
Version: None
Description:
Someone just reported to me that Windows [glob] returns files named .* under [glob *]

This is quite inconvenient, as in this case we're running over a SVN checkout, with .svn directories all over.  I'll have to further-filter the results from [glob] to exclude these.

I'd suggest a -unix 1 option or something so I can make [glob] work just as it does under unix.
User Comments:
ferrieux added on 2010-05-20 14:33:22:
Hmmm, what about being bold for once ? At the cost of a minor potential incompatibility, we could continue Tcl's (original) tradition of wiping out platform differences by fixing the Windows side instead of adding yet another platform-specific option...

Is this cost deemed too high ?

dkf added on 2010-05-20 15:46:09:
By default, [glob] doesn't return hidden files and [glob -types hidden] returns only hidden files. The *real* issue is that your SVN client isn't marking the .svn directories as hidden; that's not Tcl's bug!

hobbs added on 2010-05-21 23:49:42:
Agreed with dkf - Tcl is doing the "right" thing using native API speak.  Windows has a way to mark files hidden, and Tcl recognizes that.  Starting with '.' means nothing special on Windows.  However, I think these kinds of x-platform peculiarities can and should be abstracted with per-interp vars, like ::tcl::hideDotFiles or something, that control this kind of behavior.  The extra C cost would be negligible, and it would ease overall coding.

Tcl OS X has several such items, but we haven't done it for more platforms.  Maybe it should be tcl::win::hideDotFiles and we can start building these up.