Sign in to follow this  
DanMarshall

Gathering file names/ Directory Structure

Recommended Posts

DanMarshall    184
Now that I've finally got music playing I'd like to set up the following: The user can store their .ogg music files in 'mygame/music', where the .exe is in 'mygame'. I want to search that directory and gather all the titles of their tracks so I can load them in at runtime, and stream a random track at the start of a level. Any suggestions as to how to go about doing this? Also, somone mentioned that loading '/music/mytrack.ogg' in my program would cause problems if it was being run outside of DOS/ Windows, on account of the directory structure. What could I be doing instead to ensure compatability across all platforms? Many thanks, Dan

Share this post


Link to post
Share on other sites
moeron    326
Assuming Windows, check out FindFirstFile on MSDN

hth
moe.ron

[edit]
Sorry, should have read the whole post better. Look into boost::filesystem for more info on cross-platform directory searching stuff.

Also using "/dir/subdir/file" should work just fine. Windows is the only system that doesn't use forward slashes I think, but they still work. I've never run into any issues with that. Maybe it would be better to use "./dir/subdir/file" for *NIX systems though so you start from the current working directory...Starting with the period would also be valid on Windows.

[Edited by - moeron on October 21, 2005 6:10:52 AM]

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this