diff --git a/SConstruct b/SConstruct index 6fceb57..08be1ad 100644 --- a/SConstruct +++ b/SConstruct @@ -45,10 +45,6 @@ env = Environment( CPPDEFINES = [ "HAVE_CONFIG_H", - # boost made a large non-backwards compatible change to their filesystem - # library. Specify version 2 explicitly. - ["BOOST_FILESYSTEM_VERSION", 2], - # We use gettext for translations. "ENABLE_NLS", diff --git a/src/MachineBase/RLVMInstance.cpp b/src/MachineBase/RLVMInstance.cpp index 2cba1aa..4dc4215 100644 --- a/src/MachineBase/RLVMInstance.cpp +++ b/src/MachineBase/RLVMInstance.cpp @@ -71,9 +71,6 @@ RLVMInstance::RLVMInstance() count_undefined_copcodes_(false), load_save_(-1) { srand(time(NULL)); - - // Set global state: allow spaces in game paths - fs::path::default_name_check(fs::native); } RLVMInstance::~RLVMInstance() {} @@ -88,7 +85,7 @@ void RLVMInstance::Run(const boost::filesystem::path& gamerootPath) { CheckBadEngine(gamerootPath, siglus_exes, _("Can't run Siglus games")); Gameexe gameexe(gameexePath); - gameexe("__GAMEPATH") = gamerootPath.file_string(); + gameexe("__GAMEPATH") = gamerootPath.string(); // Possibly force starting at a different seen if (seen_start_ != -1) @@ -109,7 +106,7 @@ void RLVMInstance::Run(const boost::filesystem::path& gamerootPath) { } SDLSystem sdlSystem(gameexe); - libReallive::Archive arc(seenPath.file_string(), gameexe("REGNAME")); + libReallive::Archive arc(seenPath.string(), gameexe("REGNAME")); RLMachine rlmachine(sdlSystem, arc); addAllModules(rlmachine); addGameHacks(rlmachine); diff --git a/src/MachineBase/SerializationGlobal.cpp b/src/MachineBase/SerializationGlobal.cpp index c06d7d3..17230b4 100644 --- a/src/MachineBase/SerializationGlobal.cpp +++ b/src/MachineBase/SerializationGlobal.cpp @@ -36,6 +36,7 @@ #include #include #include +#include #include #include #include @@ -117,8 +118,8 @@ void loadGlobalMemory(RLMachine& machine) { // data is corrupted. Either way, we can't safely do ANYTHING with this // game's entire save data so move it out of the way. fs::path save_dir = machine.system().gameSaveDirectory(); - fs::path dest_save_dir = save_dir.branch_path() / - (save_dir.leaf() + ".old_corrupted_data"); + fs::path dest_save_dir = save_dir.parent_path() / + (save_dir.filename() / ".old_corrupted_data"); if (fs::exists(dest_save_dir)) fs::remove_all(dest_save_dir); diff --git a/src/Modules/Module_Sys_Save.cpp b/src/Modules/Module_Sys_Save.cpp index 02284ea..09cf443 100644 --- a/src/Modules/Module_Sys_Save.cpp +++ b/src/Modules/Module_Sys_Save.cpp @@ -255,7 +255,7 @@ struct LatestSave : public RLOp_Store_Void { if (fs::exists(saveDir)) { fs::directory_iterator end; for (fs::directory_iterator it(saveDir); it != end; ++it) { - string filename = it->leaf(); + string filename = it->path().filename().string(); if (starts_with(filename, "save") && ends_with(filename, ".sav.gz")) { time_t mtime = fs::last_write_time(*it); diff --git a/src/Systems/Base/GraphicsSystem.cpp b/src/Systems/Base/GraphicsSystem.cpp index 592216a..a983649 100644 --- a/src/Systems/Base/GraphicsSystem.cpp +++ b/src/Systems/Base/GraphicsSystem.cpp @@ -766,7 +766,7 @@ GraphicsObjectData* GraphicsSystem::buildObjOfFile( throw rlvm::Exception(oss.str()); } - string file_str = full_path.file_string(); + string file_str = full_path.string(); if (iends_with(file_str, "g00") || iends_with(file_str, "pdt")) { return new GraphicsObjectOfFile(system(), filename); } else if (iends_with(file_str, "anm")) { diff --git a/src/Systems/Base/KOEPACVoiceArchive.cpp b/src/Systems/Base/KOEPACVoiceArchive.cpp index 5a53389..ec712a1 100644 --- a/src/Systems/Base/KOEPACVoiceArchive.cpp +++ b/src/Systems/Base/KOEPACVoiceArchive.cpp @@ -167,7 +167,7 @@ int8_t koe_ad_trans_tbl[256] = { class KOEPACVoiceSample : public VoiceSample { public: KOEPACVoiceSample(fs::path file, int offset, int length, int rate) - : stream_(std::fopen(file.external_file_string().c_str(), "rb")), + : stream_(std::fopen(file.native().c_str(), "rb")), offset_(offset), length_(length), rate_(rate) { } diff --git a/src/Systems/Base/NWKVoiceArchive.cpp b/src/Systems/Base/NWKVoiceArchive.cpp index e5abccf..f215b18 100644 --- a/src/Systems/Base/NWKVoiceArchive.cpp +++ b/src/Systems/Base/NWKVoiceArchive.cpp @@ -55,7 +55,7 @@ class NWKVoiceSample : public VoiceSample { NWKVoiceSample::NWKVoiceSample(boost::filesystem::path file, int offset, int length) - : stream_(std::fopen(file.external_file_string().c_str(), "rb")), + : stream_(std::fopen(file.native().c_str(), "rb")), offset_(offset), length_(length) { } diff --git a/src/Systems/Base/OVKVoiceSample.cpp b/src/Systems/Base/OVKVoiceSample.cpp index 0318356..efef262 100644 --- a/src/Systems/Base/OVKVoiceSample.cpp +++ b/src/Systems/Base/OVKVoiceSample.cpp @@ -113,7 +113,7 @@ std::string oggErrorCodeToString(int code) { } // namespace OVKVoiceSample::OVKVoiceSample(fs::path file) - : stream_(std::fopen(file.external_file_string().c_str(), "rb")), + : stream_(std::fopen(file.native().c_str(), "rb")), offset_(0), length_(0) { std::fseek(stream_, 0, SEEK_END); length_ = ftell(stream_); @@ -121,7 +121,7 @@ OVKVoiceSample::OVKVoiceSample(fs::path file) } OVKVoiceSample::OVKVoiceSample(fs::path file, int offset, int length) - : stream_(std::fopen(file.external_file_string().c_str(), "rb")), + : stream_(std::fopen(file.native().c_str(), "rb")), offset_(offset), length_(length) { } diff --git a/src/Systems/Base/System.cpp b/src/Systems/Base/System.cpp index aa5990d..636a007 100644 --- a/src/Systems/Base/System.cpp +++ b/src/Systems/Base/System.cpp @@ -466,7 +466,7 @@ void System::buildFileSystemCache() { fs::directory_iterator dir_end; for (fs::directory_iterator dir(gamepath); dir != dir_end; ++dir) { if (fs::is_directory(dir->status())) { - std::string lowername = dir->path().filename(); + std::string lowername = dir->path().filename().string(); to_lower(lowername); if (find(valid_directories.begin(), valid_directories.end(), lowername) != valid_directories.end()) { @@ -482,14 +482,14 @@ void System::addDirectoryToCache(const fs::path& directory) { if (fs::is_directory(dir->status())) { addDirectoryToCache(dir->path()); } else { - std::string extension = dir->path().extension(); + std::string extension = dir->path().extension().string(); if (extension.size() > 1 && extension[0] == '.') extension = extension.substr(1); to_lower(extension); if (find(ALL_FILETYPES.begin(), ALL_FILETYPES.end(), extension) != ALL_FILETYPES.end()) { - std::string stem = dir->path().stem(); + std::string stem = dir->path().stem().string(); to_lower(stem); filesystem_cache_.insert( diff --git a/src/Systems/Base/VoiceCache.cpp b/src/Systems/Base/VoiceCache.cpp index ad30131..d1b6371 100644 --- a/src/Systems/Base/VoiceCache.cpp +++ b/src/Systems/Base/VoiceCache.cpp @@ -93,7 +93,7 @@ shared_ptr VoiceCache::findArchive(int file_no) const { return shared_ptr(); } - string file_str = file.file_string(); + string file_str = file.string(); if (iends_with(file_str, "ovk")) { return shared_ptr(new OVKVoiceArchive(file, file_no)); } else if (iends_with(file_str, "nwk")) { @@ -116,7 +116,7 @@ shared_ptr VoiceCache::findUnpackedSample( fs::path file = sound_system_.system().findFile(oss.str(), KOE_LOOSE_FILETYPES); - string file_str = file.file_string(); + string file_str = file.string(); if (iends_with(file_str, "ogg")) { return shared_ptr(new OVKVoiceSample(file)); diff --git a/src/Systems/SDL/SDLGraphicsSystem.cpp b/src/Systems/SDL/SDLGraphicsSystem.cpp index 4b444c8..0c07e2c 100644 --- a/src/Systems/SDL/SDLGraphicsSystem.cpp +++ b/src/Systems/SDL/SDLGraphicsSystem.cpp @@ -572,7 +572,7 @@ boost::shared_ptr SDLGraphicsSystem::loadNonCGSurfaceFromFile( } // Glue code to allow my stuff to work with Jagarl's loader - FILE* file = fopen(filename.file_string().c_str(), "rb"); + FILE* file = fopen(filename.string().c_str(), "rb"); if (!file) { ostringstream oss; oss << "Could not open file: " << filename; diff --git a/src/Systems/SDL/SDLMusic.cpp b/src/Systems/SDL/SDLMusic.cpp index ebcb611..7d32a96 100644 --- a/src/Systems/SDL/SDLMusic.cpp +++ b/src/Systems/SDL/SDLMusic.cpp @@ -205,7 +205,7 @@ boost::shared_ptr SDLMusic::CreateMusic( throw rlvm::Exception(oss.str()); } - const string& raw_path = file_path.external_file_string(); + const string& raw_path = file_path.native(); for (FileTypes::const_iterator it = types.begin(); it != types.end(); ++it) { if (iends_with(raw_path, it->first)) { FILE* f = fopen(raw_path.c_str(), "r"); diff --git a/src/Systems/SDL/SDLSoundChunk.cpp b/src/Systems/SDL/SDLSoundChunk.cpp index 99c5ac7..ee57b51 100644 --- a/src/Systems/SDL/SDLSoundChunk.cpp +++ b/src/Systems/SDL/SDLSoundChunk.cpp @@ -51,11 +51,11 @@ SDLSoundChunk::~SDLSoundChunk() { } Mix_Chunk* SDLSoundChunk::loadSample(const boost::filesystem::path& path) { - if (boost::iequals(path.extension(), ".nwa")) { + if (boost::iequals(path.extension().string(), ".nwa")) { // Hack to load NWA sounds into a MixChunk. I was resisted doing this // because I assumed there was a better way, but this is essentially what // jagarl does in xclannad too :( - FILE* f = fopen(path.external_file_string().c_str(), "r"); + FILE* f = fopen(path.native().c_str(), "r"); if (!f) return NULL; int size = 0; @@ -67,7 +67,7 @@ Mix_Chunk* SDLSoundChunk::loadSample(const boost::filesystem::path& path) { return chunk; } else { - return Mix_LoadWAV(path.external_file_string().c_str()); + return Mix_LoadWAV(path.native().c_str()); } } diff --git a/src/Systems/SDL/SDLTextSystem.cpp b/src/Systems/SDL/SDLTextSystem.cpp index 07cea54..1c64049 100644 --- a/src/Systems/SDL/SDLTextSystem.cpp +++ b/src/Systems/SDL/SDLTextSystem.cpp @@ -139,7 +139,7 @@ int SDLTextSystem::charWidth(int size, uint16_t codepoint) { boost::shared_ptr SDLTextSystem::getFontOfSize(int size) { FontSizeMap::iterator it = map_.find(size); if (it == map_.end()) { - string filename = findFontFile(system()).external_file_string(); + string filename = findFontFile(system()).native(); TTF_Font* f = TTF_OpenFont(filename.c_str(), size); if (f == NULL) { ostringstream oss; diff --git a/src/Utilities/File.cpp b/src/Utilities/File.cpp index 2db0e2e..8d1c5de 100644 --- a/src/Utilities/File.cpp +++ b/src/Utilities/File.cpp @@ -72,7 +72,7 @@ fs::path correctPathCase(fs::path Path) { // which may have incorrect case. stack pathElts; while (!Path.empty() && !exists(Path)) { - pathElts.push(Path.leaf()); + pathElts.push(Path.filename().string()); Path = Path.branch_path(); } // Now proceed forwards through the possibly-incorrect elements. @@ -96,10 +96,10 @@ fs::path correctPathCase(fs::path Path) { directory_iterator end; bool found = false; for (directory_iterator dir(Path); dir != end; ++dir) { - string uleaf = dir->leaf(); + string uleaf = dir->path().filename().string(); to_upper(uleaf); if (uleaf == elt && (!needDir || is_directory(*dir))) { - Path /= dir->leaf(); + Path /= dir->path().filename(); found = true; break; } diff --git a/src/libReallive/archive.cpp b/src/libReallive/archive.cpp index fbde57b..f36e222 100644 --- a/src/libReallive/archive.cpp +++ b/src/libReallive/archive.cpp @@ -100,7 +100,7 @@ void Archive::readOverrides() { fs::path seen_dir = fs::path(name).branch_path(); fs::directory_iterator end; for (fs::directory_iterator it(seen_dir); it != end; ++it) { - string filename = it->leaf(); + string filename = it->path().filename().string(); if (filename.size() == 12 && istarts_with(filename, "seen") && iends_with(filename, ".txt") && diff --git a/vendor/wxInclude.cpp b/vendor/wxInclude.cpp index 7d4e6c5..0203f55 100644 --- a/vendor/wxInclude.cpp +++ b/vendor/wxInclude.cpp @@ -266,7 +266,7 @@ int main(int argc, char* argv[]) { std::cout << "Process: file '" << file << "'..." << std::endl; /* Remove extension */ - file = inputpath.leaf(); + file = inputpath.filename().string(); boost::erase_last( file, fileext ); if ( !opt.count( "respectcase" ) ) @@ -316,7 +316,7 @@ int main(int argc, char* argv[]) { fs::ifstream input( dir_itr->path(), std::ios::in | std::ios::binary | std::ios::ate ); input.rdbuf()->pubsetbuf( inbuffer, BUFFER_SIZE ); - std::string file( dir_itr->path().leaf() ); + std::string file( dir_itr->path().filename().string() ); if ( input.is_open() ) { /* Show status */