Re: file.e, dir() function and glob

new topic     » goto parent     » topic index » view thread      » older message » newer message

Jeremy Cowgar wrote:
> 
> Spawned from bug report (<a
> href="http://sourceforge.net/tracker/index.php?func=detail&aid=1608870&group_id=182827&atid=902782">http://sourceforge.net/tracker/index.php?func=detail&aid=1608870&group_id=182827&atid=902782</a>)
> 
> 
> I did some research and as already known, dir("*.abc") is not cross-platform.
> It only works in some cases on DOS and Windows. *.abc will return (using
> OpenWatcom
> only, as the test compiler) *.abc and *.abcd, *.abce, or whatever happens to
> follow *.abc. 
> 
> In the bug report I suggested using dir() in the POSIX manner it was intended,
> i.e. no wildcards...
> dir("."), dir(".."), dir ("\\EUPHORIA"), dir("/opt/euphoria") for example and
> then introduce
> a new function in file.e named glob, <a
> href="http://en.wikipedia.org/wiki/Glob_%28programming%29">http://en.wikipedia.org/wiki/Glob_%28programming%29</a>
> ...
> 
> I've created the glob function and tested it on Windows and Linux and it works
> just as expected.
> 
> glob("*.abc") returns anything .abc, not everything .abc and .abcd. But the
> real benefit is it works on Windows, Linux and presumably FreeBSD.
> 
> I would like to commit the glob function to SVN and recommend it for a
> cross-platform,
> working solution to the dir("*.abc") problem. Does anyone have objections?
> 
> --
> Jeremy Cowgar
> <a href="http://jeremy.cowgar.com">http://jeremy.cowgar.com</a>

I object.  By changing the existing functionality of dir, any program that
depends on it using wildcards (I have several dozen) will break.  I recommend
that the glob function be named glob_dir to allow for future introduction of
glob(sequence pattern, sequence strings).  I also recommend that glob_dir be
introduced immediately, but that existing dir functionality not be changed
until version 3.3.  Documentation for dir in version 3.1.x and 3.2 should 
clearly state that the behavior of the statement will be changing.  This 
should give programmers time to adjust their code without having to scramble.
Thank you, Jeremy, for taking the time to address this issue.  BTW, what
are you doing differently to prevent DOS and Windows from returning
*.abc* when only *.abc was requested?

Michael J. Sabal

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu