views:

429

answers:

3

Do any C++ GNU standalone classes exist which handle paths cross platform? My applications build on Windows and LInux. Our configuration files refer to another file in a seperate directory. I'd like to be able to read the path for the other configuration file into a class which would work on both Linux or Windows.

Which class would offer the smallest footprint to translate paths to use on either system? Thanks

+4  A: 

Unless you're using absolute paths, there's no need to translate at all - Windows automatically converts forward slashes into backslashes, so if you use relative paths with forward slash path separators, you'll be golden. You should really avoid absolute paths if at all possible.

Adam Rosenfield
For the simple need I have, this is perfect.
Dan Pieczynski
not portable to OS's with different escape, quote and delimiter rules (e.g., Mac)
jwfearn
+6  A: 

try boost::filesystem

gbjbaanb
Boost appears to be very complete, but for my basic needs overkill. Thanks for the input.
Dan Pieczynski
+3  A: 

Filesystem library in boost will probably help you.

Jonas Gulle