Re: Bug in dir() leads to Unicode and win_dir()

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

> }}}
<eucode>
> junk = win_dir(folname)
>=20
> the t_race shows after this line:
> folname={70F,58:,92\,100d,97a,116t,97a,92\,109m,117u,115s,105i,99c}
> junk={{{109m,117u,115s,105i,99c},{100d},0,105i,7,7,0,8,23}}
> </eucode>
{{{

>
> Which is not right, since there is no 'music' subfolder of "F:\data\music=
".
>
> I'm running WinXP SP2 and the F: Drive is NTFS.

I forgot to mention this. I'll add it to the include file, here's why:

Let's say "F:\data\music" is a folder. You want all the files inside
that folder. You must specify win_dir( "F:\data\music\" ) with the
leading backslash. If you don't, win_dir() will return the information
*for that folder*.

This information may be found here:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/fileio/f=
s/findfirstfile.asp

Specifically:
<quote>
To examine a directory that is not a root directory, use the path to
that directory, without a trailing backslash. For example, an argument
of "C:\windows" returns information about the directory "C:\windows",
not about a directory or file in "C:\windows". An attempt to open a
search with a trailing backslash always fails.
</quote>

What Microsoft is saying, is that to obtain information about a
specific directory, specify "F:\data\music" to get information about
the files in a directory, specify "F:\data\music\*" and that
"F:\data\music\" is invalid.

Right now, win_dir() check for a trailing backslash and if it occurs,
adds a * to get all files. If you don't specify a trailing backslash,
then I have no way of knowing if you specified a specific file or a
folder.


> Also, while I'm here, when this didn't work I was attempting to add this
> to the include file:
>
> I don't know if this can be incorporated?

I just do this, it is much easier:

my_dir = routine_id("win_dir")
    junk = walk_dir( path, my_entry_routine, 1 )


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

Search



Quick Links

User menu

Not signed in.

Misc Menu