Platform-indep. file browser dialog--help!

Does anyone know a platform-independent way–for example, opening a
"directory handle" (as in Perl, etc.)–that allows one to get the contents
of a directory? This would be great for a file-selection dialog (take, for
example, the map selection dialog in Starcraft).

Currently, the only way I know of is to do something like system(“dir /b >
dir.temp”) (or ‘ls’) and then open and read the dir.temp file.
It just seems like there should be a less messy way to do this, doesn’t it?

What would be really nice, on the Win32 platform, is to have Desktop and
My Computer as the top two directory levels, with drive letters below;
however, that requires way more intimate knowledge of Windows than I
currenlty have! I do know, however, that it has to do with PIDLs and
IShellFolderInterfaces and maybe SHGetDesktopFolder. Furthermroe, I assume
MacOS might have something similar… (Luckily, *NIX systems all stem from
/. : ) Currently, however, it doesn’t look as if SDL has any functions for
cross-platform file browsing.

Can anyone offer help?

Brent

Can anyone offer help?

Brent

I wrote a small cross platform (windows/linux) file library that could help.

I’m very busy at the moment but if you’re interested I’ll dig up the sources
and post them as soon as possible.

Does anyone know a platform-independent way–for example, opening a
"directory handle" (as in Perl, etc.)–that allows one to get the contents
of a directory?

I agree it would be useful but until SDL needs it internally I think
it’s better put in an external library. on the other hand it wouldn’t
be much code so if anyone has a really good reason we could stick it in

Simple directory access may be suitable for SDL however something expandable
like the SDL_RWops is whats really required and is probably more suited to an
external lib. You want to be able to do fancy stuff like listing zip and other
pak file formats, ftp directories, a safe chroot implementation and a host of
other crap that someone somewhere is gonna want to use.On Sat, Jan 13, 2001 at 05:24:11PM +0100, Mattias Engdegard wrote:

Does anyone know a platform-independent way–for example, opening a
"directory handle" (as in Perl, etc.)–that allows one to get the contents
of a directory?

I agree it would be useful but until SDL needs it internally I think
it’s better put in an external library. on the other hand it wouldn’t
be much code so if anyone has a really good reason we could stick it in


Martin

Bother said Pooh, as the vice squad took his .GIF files.

I say put it in an external lib too. My reason is that I think SDL is
eventually gonna make it’s way to some weird targets, like embeded
stuff and PDA’s and file systems may not exists on those.

Martin Donlon wrote:

Does anyone know a platform-independent way–for example, opening a
"directory handle" (as in Perl, etc.)–that allows one to get the
contents

of a directory?

I agree it would be useful but until SDL needs it internally I think
it’s better put in an external library. on the other hand it wouldn’t
be much code so if anyone has a really good reason we could stick it in

Simple directory access may be suitable for SDL however something
expandable
like the SDL_RWops is whats really required and is probably more suited to
an
external lib. You want to be able to do fancy stuff like listing zip and
other
pak file formats, ftp directories, a safe chroot implementation and a host
of> On Sat, Jan 13, 2001 at 05:24:11PM +0100, =?ISO-8859-1?Q?Mattias Engdeg=E5rd?= wrote:
other crap that someone somewhere is gonna want to use.


Martin

Bother said Pooh, as the vice squad took his .GIF files.

Brent Schartung schrieb am 12 Jan 2001:

Does anyone know a platform-independent way–for example, opening a
"directory handle" (as in Perl, etc.)–that allows one to get the contents
of a directory? This would be great for a file-selection dialog (take, for
example, the map selection dialog in Starcraft).

readdir() is POSIX and should be fairly portable. I noticed that
VC++ 5.0 header files don’t know about it, but cross-compiling the
code for win32 works flawless. For MacOS specific code, see
directory.c in the CVS version of GLtron.

  • Andreas–
    Check out my 3D lightcycle game: http://www.gltron.org
    A 0.60 preview/beta for win32/mac is available NOW!
    More than 100’000 Downloads of the last version (0.59)

If you want, I also have system independant directoy that works (or should)
on win32, macintosh and any glibc target. If you are interested I can mail
them to you because they are just 10ko of source code

Stephane

In fact, if you wanna look at a full implementation of directory box,
you can have a look at the SGU directory code in the SnakeMe
source archive. You can get it at
http://www.ysagoon.com/snakeme/download.html

Stephane

It’s mean to cut out all the VC people just because VC is POSIX
compliant… Luckily that’s the one platform/compiler I have
directory code for :slight_smile:

Andreas Umbach wrote:

Brent Schartung schrieb am 12 Jan 2001:

Does anyone know a platform-independent way–for example, opening a
"directory handle" (as in Perl, etc.)–that allows one to get the
contents

of a directory? This would be great for a file-selection dialog (take,
for> > example, the map selection dialog in Starcraft).

readdir() is POSIX and should be fairly portable. I noticed that
VC++ 5.0 header files don’t know about it, but cross-compiling the
code for win32 works flawless. For MacOS specific code, see
directory.c in the CVS version of GLtron.

  • Andreas

    Check out my 3D lightcycle game: http://www.gltron.org
    A 0.60 preview/beta for win32/mac is available NOW!
    More than 100’000 Downloads of the last version (0.59)