From bug-request at octave dot org Thu Mar 16 19:11:19 2006 Subject: Re: dir.m bugs From: "John W. Eaton" To: Bill Denney Cc: bugs at octave dot org Date: Thu, 16 Mar 2006 20:10:51 -0500 On 16-Mar-2006, Bill Denney wrote: | > Also, in Matlab I think all of the following are equivalent: | > | > dir | > dir ('.') | > dir ('*') | > | > I think the way to handle this is to add a check at the top to convert | > "*" to ".". | | But what about things like dir('a*') or other wildcards? We would still | have the revursive behavior. I could add a test that would see if the | globbed file list was more than one long, and if it was then I would not | recurse, and if it was only one long I would recurse the directory. That | is the only way that I can think of making it recurse in the "right" | circumstances. Right, you first check if it is "*" by itself and convert that to ".", then glob, then check the length of the list returned from glob. If that list is just one element and it is a directory, you read the directory contents. Otherwise, you just report info on the list of files (including directories) but you don't read the contents of the directories. You could skip globbing if the arg (after converting no args and "*" to ".") is just ".". | > Finally, there is now a way to construct a 0x1 struct array: | > | > struct (zeros (0, 1)) | > | > should work. | | Nice. Why was this change made instead of just making | | struct() | | do it? Because of the dreaded compatibility, which requires that struct () produce a 1x1 struct with no fields. jwe ------------------------------------------------------------- Octave is freely available under the terms of the GNU GPL. Octave's home on the web: http://www.octave.org How to fund new projects: http://www.octave.org/funding.html Subscription information: http://www.octave.org/archive.html -------------------------------------------------------------