[physfs] Not finding any directories
t.wilson at hazid.com
Thu Dec 16 06:04:28 EST 2004
Berry, David wrote:
> I have the following code
> char **rc = PHYSFS_enumerateFiles("music");
> char **i;
I think the documentation for "PHYSFS_enumerateFiles" indicates that NO
directory names will be returned in the array.
From the docs:
Matching directories are interpolated. That is, if "C:\mydir" is in the
search path and contains a directory "savegames" that contains "x.sav",
"y.sav", and "z.sav", and there is also a "C:\userdir" in the search
path that has a "savegames" subdirectory with "w.sav" [snip]
* We've got [x.sav].
* We've got [y.sav].
* We've got [z.sav].
* We've got [w.sav].
So, here you have in the search path
and the following files:
and it clearly isn't showing "savegames" or even ".", ".." in the list
which would of course exist on (some?) file systems.
I don't think this function is going to do what you need. Perhaps you
could use playlists which indicate where the files are stored?
Also, another point is that the docs say: "We only promise there will
be no duplicates"
so if you had
C:\foo\Ace of Base - All That She Wants.MP3
C:\myMp3s\Ace of Base - All That She Wants.MP3
I *think* you would only get one song returned, even though the two
files may be different remixes. I haven't tested this though.
> for (i = rc; *i != NULL; i++)
> if (PHYSFS_isDirectory(*i) != 0)
> logToFile(" * We've got dir [%s].", *i);
> I have a directory tree full of music files, and I am attempting to find
> out all the directories contained within.
> If I just log the string *i, I can see everything, files and directory
> names – if I attempt to ‘detect’ a directory, I get nothing.
> Eg: Just printing out the output gets
> 23:27:47 > * We've got dir [Ace of Base - All That She Wants.MP3].
> 23:27:47 > * We've got dir [BEVERLY HILLS COP.MP3].
> 23:27:47 > * We've got dir [CD 4]. ß-- These are directories
> 23:27:47 > * We've got dir [CD 5]. ß--- This is a directory
> It’s running on a XP box compiled with Bloodshed 126.96.36.199.
> Any idea on why I can’t detect my directories – or does someone have
> some code to ‘walk’ a tree and display all the files contained within.
> I’m writing a basic MP3 player – which you can point at your music store
> and play everything.
More information about the physfs