The SDL forums have moved to discourse.libsdl.org.
This is just a read-only archive of the previous forums, to keep old links working.


SDL Forum Index
SDL
Simple Directmedia Layer Forums
Directory listings
Mike Powell
Guest

I'd like to set up my app to read the contents of a directory, without
resorting to any Windows-specific code (since I do intend to port my
code eventually to at least Mac, and likely other *nix systems as well,
eventually). None of the ANSI code does this, of course, and as best I
can tell nothing in the SDL core allows this either. I can't find any
libraries listed on libsdl.org which handle this either. Can anybody
suggest anything?

What I'm trying to do, specifically, is set up a proper file-loading
dialog, in GUIchan, to be used in the editor for my graphics engine.
Otherwise I'm just going to have to make the user enter the file names
by hand, which is a rather ugly solution.
Directory listings
Bill Kendrick
Guest

On Thu, Jan 19, 2006 at 08:01:25PM -0800, Mike Powell wrote:
Quote:
I'd like to set up my app to read the contents of a directory, without
resorting to any Windows-specific code (since I do intend to port my
code eventually to at least Mac, and likely other *nix systems as well,
eventually). None of the ANSI code does this, of course, and as best I
can tell nothing in the SDL core allows this either. I can't find any
libraries listed on libsdl.org which handle this either. Can anybody
suggest anything?

Tux Paint internally traverses the contents of directories and subdirectories
when loading Stamps, Brushes and in the Open dialog, on Windows, Mac OS X,
Linux/BSD/Unix/etc. and BeOS.

It's, err, a little messy in there lately, since some of the load-up stuff
has been separated into sub-threads (e.g., it can load stamps and fonts
while you're painting), but it might be worth a look.

Hit the CVSWeb via:

http://www.sf.net/projects/tuxpaint/

Or just download 0.9.15b.


OTOH, I'd be surprised if someone doesn't have a better, simpler example,
or a useful cross-platform library for opening and traversing the contents
of a directory. :)

--
-bill! Tux Paint 2006 wall calendar,
bill at newbreedsoftware.com CDROM, bumper sticker & apparel
http://www.newbreedsoftware.com/ http://www.cafepress.com/newbreedsw
Directory listings
Daniel K. O.
Guest

Mike Powell wrote:
Quote:
What I'm trying to do, specifically, is set up a proper file-loading
dialog, in GUIchan, to be used in the editor for my graphics engine.
Otherwise I'm just going to have to make the user enter the file names
by hand, which is a rather ugly solution.

Why not use Boost.Filesystem?
http://www.boost.org/libs/filesystem/doc/index.htm

Also, there are other GUI libraries for SDL that already have a
file-loading dialog. A quick search revealed PicoGUI and Agar. If you
are using OpenGL, there are even more options.

---
Daniel K. O.
Directory listings
Gaetan de Menten
Guest

On 1/20/06, Mike Powell <belar at sevensouth.com> wrote:

Quote:
I'd like to set up my app to read the contents of a directory, without
resorting to any Windows-specific code (since I do intend to port my
code eventually to at least Mac, and likely other *nix systems as well,
eventually). None of the ANSI code does this, of course, and as best I
can tell nothing in the SDL core allows this either. I can't find any
libraries listed on libsdl.org which handle this either. Can anybody
suggest anything?

If I understood you correctly, PhysicsFS does what you want... It's
easy and has a clean API (IMHO) and it's done by Ryan C. Gordon. It
can be found at: http://icculus.org/physfs/

Quote:
What I'm trying to do, specifically, is set up a proper file-loading
dialog, in GUIchan, to be used in the editor for my graphics engine.
Otherwise I'm just going to have to make the user enter the file names
by hand, which is a rather ugly solution.
Directory listings
Martin Wegner
Guest

Hello.

If you are using mingw for your Windows builds, you can use POSIX
functions for this as there are:

- opendir
- readdir
- closedir

(Under Linux: man 3 opendir)

At least I'm using them and it works for me.

Regards, martin

Mike Powell wrote:
Quote:
[...]

--
Get my public GPG key from pgp.mit.edu or wwwkeys.pgp.net
Key ID: 0x44085D12
--
Homepage: http://mroot.net/
Powered by Gentoo Linux (http://gentoo.org/)

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 890 bytes
Desc: OpenPGP digital signature
Url : http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20060120/dda95713/attachment.pgp
Directory listings
Mike Powell
Guest

Daniel K. O. wrote:

Quote:
Mike Powell wrote:

Quote:
What I'm trying to do, specifically, is set up a proper file-loading
dialog, in GUIchan, to be used in the editor for my graphics engine.
Otherwise I'm just going to have to make the user enter the file
names by hand, which is a rather ugly solution.


Why not use Boost.Filesystem?
http://www.boost.org/libs/filesystem/doc/index.htm

I don't really know much about Boost, though I've heard of it. It might
be worth a try.

Quote:
Also, there are other GUI libraries for SDL that already have a
file-loading dialog. A quick search revealed PicoGUI and Agar. If you
are using OpenGL, there are even more options.

I have researched a number of GUI systems. The thing that finally
attracted me to GUIchan above the others is not that it has greater
functionality, but that it has fewer dependencies. I wasted many hours
trying, and failing, to get ParaGUI to work, since it has no Windows
binary, and some of it's dependencies don't have binaries either. I
looked into a few other GUI systems that I quickly dismissed after
seeing that they had similar dependency lists.

However, I had compiled a GUIchan sample app within 10 minutes of
downloading it. It required only SDL and SDL_image.
Directory listings
Mike Powell
Guest

Gaetan de Menten wrote:

Quote:
On 1/20/06, Mike Powell <belar at sevensouth.com> wrote:



Quote:
I'd like to set up my app to read the contents of a directory, without
resorting to any Windows-specific code (since I do intend to port my
code eventually to at least Mac, and likely other *nix systems as well,
eventually). None of the ANSI code does this, of course, and as best I
can tell nothing in the SDL core allows this either. I can't find any
libraries listed on libsdl.org which handle this either. Can anybody
suggest anything?



If I understood you correctly, PhysicsFS does what you want... It's
easy and has a clean API (IMHO) and it's done by Ryan C. Gordon. It
can be found at: http://icculus.org/physfs/


This isn't exactly what I asked for. It's better. I haven't tried it out
yet, but reading over the description, this library sounds like it's
even more ideal for my purposes then I had dared to hope for. :-)
Directory listings
Jeff
Guest

On Friday 20 January 2006 12:20 pm, Mike Powell wrote:
Quote:
Quote:

Why not use Boost.Filesystem?
http://www.boost.org/libs/filesystem/doc/index.htm

I don't really know much about Boost, though I've heard of it. It might
be worth a try.

FWIW, I started compiling Boost at 7:30 this morning before I left for work.
When I got home at 3:00pm, it was still compiling (800MHz Intel cpu, 256Mb
ram, RH 7.2 Linux). Methinks you'd be better off using physfs.

Jeff
Directory listings
Jeff
Guest

On Friday 20 January 2006 12:20 pm, Mike Powell wrote:
Quote:
Quote:

Why not use Boost.Filesystem?
http://www.boost.org/libs/filesystem/doc/index.htm

I don't really know much about Boost, though I've heard of it. It might
be worth a try.

FWIW, I started compiling Boost at 7:30 this morning before I left for work.
When I got home at 3:00pm, it was still compiling (800MHz Intel cpu, 256Mb
ram, RH 7.2 Linux). Methinks you'd be better off using physfs.

Jeff