Opened 16 years ago
Closed 16 years ago
#315 closed defect (fixed)
Use boost::filesystem paths
Reported by: | rgrieder | Owned by: | nobody |
---|---|---|---|
Priority: | major | Milestone: | Version 0.3 Codename: Castor |
Component: | GeneralFramework | Version: | 0.2.0 |
Keywords: | filesystem filepath | Cc: | |
Referenced By: | References: |
Description
We've got lots of filenames and filepaths. And they might be Unix or Windows incompatible. Best solution would be to always use boost::filesystem::path to take care of all the platform specific stuff.
Unfortunately <boost/filesystem.hpp> has quite a large tail so including it in many source files takes a lot of time. I recommend not resolving this ticket unless we have support for precompiled header files.
Change History (2)
comment:1 Changed 16 years ago by rgrieder
comment:2 Changed 16 years ago by rgrieder
- Resolution set to fixed
- Status changed from new to closed
Worth noting: fstream.open() works with Unix forward slashes on Windows. So you can easily use Core::getMediaPathString() (already includes a "/" at the end).
I therefore declare this ticket as more or less resolved since I don't see where else it would be really necessary to use boost::filesystem.
For about two days the Core class has methods that return a reference to a boost::filesystem::path. That works without including the boost header (notice the forward declaration at the beginning of Core.h).
In order to store the paths I had to make a minor workaround using global variables that have internal linkage (that means they cannot be referenced from anywhere else than Core.cc). The usual way would have been to use a global variable that is declared in the Core class hence including boost/filesystem.hpp in Core.h
The following classes already make use of boost::filesystem: Core, CommandLine, ConfigFileManager, Language, ArgumentCompletionFunctions, LuaBind, GSGraphics and GUIManager.