...too much stuff to go through in one sitting....
Wow, thanks for that write-up; it contains alot of the kind of information I'm trying to understand. Some of it is really surprising, like the "D:abc.txt" and "\abc.txt" - both those meanings are new to me, and seem likely to accidentally occur in day-to-day programming.
I did a poor job of explaining myself: I'm currently using boost::filesystem for the actual OS interaction.
Boost gives a list of "cross platform" recommendations, but it seems exceedingly strict for modern OSes, so I'm wondering where I can ease up the restrictions if I only include things made in the past 10 years.
Since I'm using boost::filesystem, I don't need to directly deal with the nitty-gritty details of Windows or Mac specific function calls (thankfully!), but my concern is about my folder structure and filenames, and where I might have complications in the future in copying the entire data directory of my game onto a Mac or Linux machine for when I make a Mac or Linux port. I would like, as much as possible, that the layout of my datafiles remain constant between Mac and Linux and Windows, for ease of porting and also so player mods of my game work cross-platform. I would rather not ship and release the Windows version and then three months after that, when I complete the Mac port, find out I need to change the whole folder structure and filenames of critical data files, and then have to update the Windows version to match the new minimum requirements of both Mac and Linux (ruining any player mods, as well as just being a nuisance), and then go through that
again in another three months when I port to Linux.
I understand there will be inevitable complications when porting from Windows to Mac or Linux, but I'd like to do what I can ahead of time, to at least reduce the complications, and getting the file system as stable as possible would greatly assist that.
My biggest concern at the moment, is I have folders filled with sub-folders with names in the format: "(x,y)"
My recent understanding is that you can't use ( or ), or even commas, on Linux machines (right?), so now I have a problem! Better to catch it now, then after I ship for Windows.
All of that complexity is why a lot of games go with a single data file approach. That is you create a single file, containing all game data, which works like (and often is) a zip file. There are cross platform libraries like http://icculus.org/physfs/ to handle reading zip files.
That's a great idea, and I would do that... but for one thing: Modding
My game is very very modable, and I do expect users to make use of that. My game's build-in level editor is (untestedly) cross platform, even.
If a user places a file in a special mod folder that follows the same folder structure as the game, the game will make use of the file instead of the game's original file, allowing users to do things like completely replace or alter the game's graphics, change NPC dialog, make fan-made translations, create their own levels or enemies, or even make an almost entirely new game - all without having to damage or replace the original data files of the game.
I suppose I could have the game data be entirely contained in one zip file, and then each mod be another zip file. It's definitely something to ponder...
What are the limitations of filenames and folder structures for .zips? I see there is a total limit of 4-ish GB, which isn't a problem, and to use forward slashes '/' instead of backslashes, which I already do. The file name, comment, and meta-data combined cannot exceed 65,535 bytes, which is plenty... But are there any limitations on symbols used? I can't see anything in the zip file format documentation about that. Filenames are optionally UTF-8 or the MSDOS ASCII, either of which work fine for me (the filenames don't need to be translated).
I just don't know what limitations there are on filenames. Can I use commas and parentheses and exclamation marks in zip filenames? Other than the 'use forward slashes', I don't see any information on the subject.
If I use zips, I'll let physFS handle it, but I still need to know how to name my files before I zip them up, and with what name to use when loading data from the zip.
[quote name='Firestryke31']What are you planning on using the long paths for? Is it something that could be better served using a file format (world info) or an archive (static game info)? Or do you just want to make sure you can write saved games to your game's data folder?[/quote]
Static game data (world, dialog, etc...) and dynamic data (config files, game saves), but all modifiable by the end-user.
At a basic level, users might just play around with the map editor a little, but at a more advanced level, they'd be manually adjust config files and creating new files in their own folder structure that mirrors the game's folder structure.
So yes, I suppose a archive file would really be the best option. One for the game, one for each mod or expansion.