• Advertisement
Sign in to follow this  

Gathering file names/ Directory Structure

This topic is 4508 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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
Advertisement
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
Sign in to follow this  

  • Advertisement