diff --git a/CMakeLists.txt b/CMakeLists.txt index 350f807e..ee2932e1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -197,7 +197,7 @@ ENDIF(OPENC2E_USE_OPENAL MATCHES "^(YES|AUTO)$") FIND_PACKAGE(ALUT) FIND_PACKAGE(Boost 1.34.0 COMPONENTS program_options filesystem thread regex serialization REQUIRED) -FIND_LIBRARY(BOOST_SYSTEM_LIBRARY NAMES boost_system-mt) +FIND_LIBRARY(BOOST_SYSTEM_LIBRARY NAMES boost_system) IF(OPENC2E_USE_QT) find_package(Qt4 REQUIRED) ENDIF(OPENC2E_USE_QT) @@ -267,14 +267,14 @@ TARGET_LINK_LIBRARIES(openc2e z m pthread ${OPENAL_LIBRARY} ${ALUT_LIBRARY} ${FRONTEND_LIBS} - boost_program_options-mt - boost_serialization-mt - boost_filesystem-mt - boost_thread-mt - boost_regex-mt + boost_program_options + boost_serialization + boost_filesystem + boost_thread + boost_regex ) IF(BOOST_SYSTEM_LIBRARY) -TARGET_LINK_LIBRARIES(openc2e boost_system-mt) +TARGET_LINK_LIBRARIES(openc2e boost_system) ENDIF(BOOST_SYSTEM_LIBRARY) LINK_DIRECTORIES(${Boost_LIBRARY_DIRS}) diff --git a/docs/openc2e.pod b/docs/openc2e.pod index eea5c5ac..5b6c15bb 100644 --- a/docs/openc2e.pod +++ b/docs/openc2e.pod @@ -118,5 +118,3 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. - -=end diff --git a/parsedocs.pl b/parsedocs.pl index a71e0bee..131a54f2 100755 --- a/parsedocs.pl +++ b/parsedocs.pl @@ -176,11 +176,21 @@ } if (!$cat) { - $cat = lc $fnmap{$file} || 'unknown'; + if ($fnmap{$file}) { + $cat = lc $fnmap{$file}; + } else { + $cat = lc 'unknown'; + } } - - $stackdelta = $pragma{stackdelta} if defined $pragma{stackdelta}; - $stackdelta = "INT_MAX" if lc $pragma{stackdelta} eq "any"; + + if (defined $pragma{stackdelta}) { + $stackdelta = $pragma{stackdelta}; + } + + if (defined $pragma{stackdelta} && lc $pragma{stackdelta} eq "any") { + $stackdelta = "INT_MAX"; + } + die "Deprecated use of pragma retc for $fullname" if defined $pragma{retc}; diff --git a/src/AudioBackend.h b/src/AudioBackend.h index 0d45ad34..a830639a 100644 --- a/src/AudioBackend.h +++ b/src/AudioBackend.h @@ -28,34 +28,24 @@ class AudioBuffer; -namespace boost { - static inline void intrusive_ptr_add_ref(AudioBuffer *p); - static inline void intrusive_ptr_release(AudioBuffer *p); -} - class AudioBuffer { - friend void boost::intrusive_ptr_add_ref(AudioBuffer *p); - friend void boost::intrusive_ptr_release(AudioBuffer *p); - -protected: - virtual void add_ref() = 0; - virtual void del_ref() = 0; - + + friend void intrusive_ptr_add_ref(AudioBuffer *p) { + p->add_ref(); + } + friend void intrusive_ptr_release(AudioBuffer *p) { + p->del_ref(); + } + public: virtual ~AudioBuffer() { } virtual unsigned int length_ms() const = 0; /* milliseconds */ virtual unsigned int length_samples() const = 0; + virtual void add_ref() = 0; + virtual void del_ref() = 0; }; typedef boost::intrusive_ptr AudioClip; -namespace boost { - static inline void intrusive_ptr_add_ref(AudioBuffer *p) { - p->add_ref(); - } - static inline void intrusive_ptr_release(AudioBuffer *p) { - p->del_ref(); - } -} /* Base class for sources of streaming data (eg, MNG music) * diff --git a/src/Catalogue.cpp b/src/Catalogue.cpp index d8ce3ed4..30ae303e 100644 --- a/src/Catalogue.cpp +++ b/src/Catalogue.cpp @@ -130,7 +130,7 @@ void Catalogue::initFrom(fs::path path) { assert(fs::exists(path)); assert(fs::is_directory(path)); - //std::cout << "Catalogue is reading " << path.native_directory_string() << std::endl; + //std::cout << "Catalogue is reading " << path.string() << std::endl; fs::directory_iterator end; std::string file; @@ -148,7 +148,7 @@ void Catalogue::initFrom(fs::path path) { } } catch (const std::exception &ex) { - std::cerr << "directory_iterator died on '" << i->path().leaf() << "' with " << ex.what() << std::endl; + std::cerr << "directory_iterator died on '" << i->path().filename().string() << "' with " << ex.what() << std::endl; } } } diff --git a/src/Engine.cpp b/src/Engine.cpp index e23466f8..56cca42f 100644 --- a/src/Engine.cpp +++ b/src/Engine.cpp @@ -107,7 +107,7 @@ void Engine::loadGameData() { if (fs::exists(palpath) && !fs::is_directory(palpath)) { palette = new unsigned char[768]; - std::ifstream f(palpath.native_directory_string().c_str(), std::ios::binary); + std::ifstream f(palpath.string().c_str(), std::ios::binary); f >> std::noskipws; f.read((char *)palette, 768); @@ -624,7 +624,7 @@ bool Engine::parseCommandLine(int argc, char *argv[]) { // add all the data directories to the list for (std::vector::iterator i = data_vec.begin(); i != data_vec.end(); i++) { - fs::path datadir(*i, fs::native); + fs::path datadir(*i); if (!fs::exists(datadir)) { throw creaturesException("data path '" + *i + "' doesn't exist"); } @@ -746,11 +746,11 @@ bool Engine::initialSetup() { // inform the user of the port used, and store it in the relevant file std::cout << "Listening for connections on port " << listenport << "." << std::endl; #ifndef _WIN32 - fs::path p = fs::path(homeDirectory().native_directory_string() + "/.creaturesengine", fs::native); + fs::path p = fs::path(homeDirectory().string() + "/.creaturesengine"); if (!fs::exists(p)) fs::create_directory(p); if (fs::is_directory(p)) { - std::ofstream f((p.native_directory_string() + "/port").c_str(), std::ios::trunc); + std::ofstream f((p.string() + "/port").c_str(), std::ios::trunc); f << boost::str(boost::format("%d") % listenport); } #endif @@ -776,7 +776,7 @@ bool Engine::initialSetup() { throw creaturesException("multiple bootstrap files provided in C1/C2 mode"); for (std::vector< std::string >::iterator bsi = cmdline_bootstrap.begin(); bsi != cmdline_bootstrap.end(); bsi++) { - fs::path scriptdir(*bsi, fs::native); + fs::path scriptdir(*bsi); if (engine.version > 2 || fs::extension(scriptdir) == ".cos") { // pass it to the world to execute (it handles both files and directories) @@ -792,7 +792,7 @@ bool Engine::initialSetup() { throw creaturesException("non-existant bootstrap file provided in C1/C2 mode"); // TODO: the default SFCFile loading code is in World, maybe this should be too.. SFCFile sfc; - std::ifstream f(scriptdir.native_directory_string().c_str(), std::ios::binary); + std::ifstream f(scriptdir.string().c_str(), std::ios::binary); f >> std::noskipws; sfc.read(&f); sfc.copyToWorld(); @@ -832,18 +832,18 @@ fs::path Engine::homeDirectory() { #ifndef _WIN32 char *envhome = getenv("HOME"); if (envhome) - p = fs::path(envhome, fs::native); + p = fs::path(envhome); if ((!envhome) || (!fs::is_directory(p))) - p = fs::path(getpwuid(getuid())->pw_dir, fs::native); + p = fs::path(getpwuid(getuid())->pw_dir); if (!fs::is_directory(p)) { std::cerr << "Can't work out what your home directory is, giving up and using /tmp for now." << std::endl; - p = fs::path("/tmp", fs::native); // sigh + p = fs::path("/tmp"); // sigh } #else TCHAR szPath[_MAX_PATH]; SHGetSpecialFolderPath(NULL, szPath, CSIDL_PERSONAL, TRUE); - p = fs::path(szPath, fs::native); + p = fs::path(szPath); if (!fs::exists(p) || !fs::is_directory(p)) throw creaturesException("Windows reported that your My Documents folder is at '" + std::string(szPath) + "' but there's no directory there!"); #endif @@ -863,18 +863,18 @@ fs::path Engine::storageDirectory() { #endif // main storage dir - fs::path p = fs::path(homeDirectory().native_directory_string() + dirname, fs::native); + fs::path p = fs::path(homeDirectory().string() + dirname); if (!fs::exists(p)) fs::create_directory(p); else if (!fs::is_directory(p)) - throw creaturesException("Your openc2e data directory " + p.native_directory_string() + " is a file, not a directory. That's bad."); + throw creaturesException("Your openc2e data directory " + p.string() + " is a file, not a directory. That's bad."); // game-specific storage dir - p = fs::path(p.native_directory_string() + std::string("/" + gamename), fs::native); + p = fs::path(p.string() + std::string("/" + gamename)); if (!fs::exists(p)) fs::create_directory(p); else if (!fs::is_directory(p)) - throw creaturesException("Your openc2e game data directory " + p.native_directory_string() + " is a file, not a directory. That's bad."); + throw creaturesException("Your openc2e game data directory " + p.string() + " is a file, not a directory. That's bad."); return p; } diff --git a/src/Map.cpp b/src/Map.cpp index d7b39399..c377a52f 100644 --- a/src/Map.cpp +++ b/src/Map.cpp @@ -145,7 +145,7 @@ bool Map::collideLineWithRoomBoundaries(Point src, Point dest, shared_ptr float distance = 100000000.0f; // TODO: lots. bool foundsomething = false; - bool previousroom = (newroom); + boost::shared_ptr previousroom = (newroom); Point oldpoint = where; Line movement(src, dest); diff --git a/src/MetaRoom.h b/src/MetaRoom.h index 9cc13a82..ea698a47 100644 --- a/src/MetaRoom.h +++ b/src/MetaRoom.h @@ -31,14 +31,14 @@ class MetaRoom { protected: FRIEND_SERIALIZE(MetaRoom) unsigned int xloc, yloc, wid, hei, fullwid, fullhei; - std::map > backgrounds; - shared_ptr firstback; + std::map > backgrounds; + boost::shared_ptr firstback; bool wraps; MetaRoom() { } public: - std::vector > rooms; + std::vector > rooms; unsigned int x() { return xloc; } unsigned int y() { return yloc; } @@ -49,21 +49,21 @@ class MetaRoom { bool wraparound() { return wraps; } void setWraparound(bool w) { wraps = !!w; } - unsigned int addRoom(shared_ptr); - void addBackground(std::string, shared_ptr = shared_ptr()); - shared_ptr getBackground(std::string); + unsigned int addRoom(boost::shared_ptr); + void addBackground(std::string, boost::shared_ptr = boost::shared_ptr()); + boost::shared_ptr getBackground(std::string); std::vector backgroundList(); - shared_ptr nextFloorFromPoint(float x, float y); + boost::shared_ptr nextFloorFromPoint(float x, float y); - shared_ptr roomAt(float x, float y); - std::vector > roomsAt(float x, float y); + boost::shared_ptr roomAt(float x, float y); + std::vector > roomsAt(float x, float y); std::string music; unsigned int id; - MetaRoom(int _x, int _y, int width, int height, const std::string &back, shared_ptr = shared_ptr(), bool wrap = false); + MetaRoom(int _x, int _y, int width, int height, const std::string &back, boost::shared_ptr = boost::shared_ptr(), bool wrap = false); ~MetaRoom(); }; diff --git a/src/MusicManager.cpp b/src/MusicManager.cpp index e08d540d..8733c1d0 100644 --- a/src/MusicManager.cpp +++ b/src/MusicManager.cpp @@ -65,7 +65,7 @@ void MusicManager::tick() { // TODO: this behaviour is different in C2, and should probably be cleverer MetaRoom *m = world.camera->getMetaRoom(); if (m) { - shared_ptr r = m->roomAt(world.camera->getXCentre(), world.camera->getYCentre()); + boost::shared_ptr r = m->roomAt(world.camera->getXCentre(), world.camera->getYCentre()); if (r && r->music.size()) { playTrack(r->music, 0); } else if (m->music.size()) { @@ -146,13 +146,13 @@ void MusicManager::playTrack(std::string track, unsigned int latency) { return; // TODO: exception? } - shared_ptr tracknode(new MusicTrack(file, file->tracks[trackname])); + boost::shared_ptr tracknode(new MusicTrack(file, file->tracks[trackname])); tracknode->init(); playTrack(tracknode); current_latency = latency; } -void MusicManager::playTrack(shared_ptr track) { +void MusicManager::playTrack(boost::shared_ptr track) { playing_silence = false; track->startFadeIn(); if (!currenttrack) { @@ -166,13 +166,13 @@ void MusicManager::playTrack(shared_ptr track) { } void MusicManager::startPlayback() { - shared_ptr src = engine.audio->getBGMSource(); + boost::shared_ptr src = engine.audio->getBGMSource(); if (!src) return; if (!stream) { // we assume no-one else ever steals the BGM stream from // under us, but what are we meant to do then anyway? - stream = shared_ptr(new MusicStream); + stream = boost::shared_ptr(new MusicStream); src->setStream(stream); src->play(); } @@ -374,7 +374,7 @@ MusicEffect::MusicEffect(MNGEffectDecNode *n) { node = n; for (std::list::iterator i = node->children->begin(); i != node->children->end(); i++) { - shared_ptr stage(new MusicStage(*i)); + boost::shared_ptr stage(new MusicStage(*i)); stages.push_back(stage); } } @@ -382,7 +382,7 @@ MusicEffect::MusicEffect(MNGEffectDecNode *n) { std::vector MusicEffect::applyEffect(class MusicTrack *t, std::vector src, float beatlength) { std::vector buffers; - for (std::vector >::iterator i = stages.begin(); i != stages.end(); i++) { + for (std::vector >::iterator i = stages.begin(); i != stages.end(); i++) { std::vector newbuffers = (*i)->applyStage(src, beatlength); for (std::vector::iterator j = newbuffers.begin(); j != newbuffers.end(); j++) { buffers.push_back(*j); @@ -392,7 +392,7 @@ std::vector MusicEffect::applyEffect(class MusicTrack *t, std: return buffers; } -MusicVoice::MusicVoice(shared_ptr p, MNGVoiceNode *n) { +MusicVoice::MusicVoice(boost::shared_ptr p, MNGVoiceNode *n) { node = n; parent = p.get(); @@ -408,7 +408,7 @@ MusicVoice::MusicVoice(shared_ptr p, MNGVoiceNode *n) { MNGWaveNode *e = dynamic_cast(n); if (e) { // TODO: share duplicate MusicWaves - wave = shared_ptr(new MusicWave(p->getParent()->getParent(), e)); + wave = boost::shared_ptr(new MusicWave(p->getParent()->getParent(), e)); continue; } @@ -441,7 +441,7 @@ MusicVoice::MusicVoice(shared_ptr p, MNGVoiceNode *n) { throw MNGFileException("couldn't find effect '" + eff->getName() + "'"); MNGEffectDecNode *n = effects[eff->getName()]; - effect = shared_ptr(new MusicEffect(n)); + effect = boost::shared_ptr(new MusicEffect(n)); continue; } @@ -460,7 +460,7 @@ bool MusicVoice::shouldPlay() { return true; } -MusicLayer::MusicLayer(shared_ptr p) { +MusicLayer::MusicLayer(boost::shared_ptr p) { parent = p.get(); updaterate = 1.0f; @@ -535,7 +535,7 @@ void MusicVoice::runUpdateBlock() { } } -MusicAleotoricLayer::MusicAleotoricLayer(MNGAleotoricLayerNode *n, shared_ptr p) : MusicLayer(p) { +MusicAleotoricLayer::MusicAleotoricLayer(MNGAleotoricLayerNode *n, boost::shared_ptr p) : MusicLayer(p) { node = n; } @@ -554,13 +554,13 @@ void MusicAleotoricLayer::init() { throw MNGFileException("couldn't find effect '" + e->getName() + "'"); MNGEffectDecNode *n = effects[e->getName()]; - effect = shared_ptr(new MusicEffect(n)); + effect = boost::shared_ptr(new MusicEffect(n)); continue; } MNGVoiceNode *v = dynamic_cast(n); if (v) { - shared_ptr voice(new MusicVoice(shared_from_this(), v)); + boost::shared_ptr voice(new MusicVoice(shared_from_this(), v)); voices.push_back(voice); continue; } @@ -618,13 +618,13 @@ void MusicAleotoricLayer::update(unsigned int latency) { std::vector buffers; float our_volume = volume * parent->getVolume(); - for (std::vector >::iterator i = voices.begin(); i != voices.end(); i++) { + for (std::vector >::iterator i = voices.begin(); i != voices.end(); i++) { if (!(*i)->shouldPlay()) continue; if ((*i)->getWave()) { FloatAudioBuffer &data = (*i)->getWave()->getData(); FloatAudioBuffer voicebuffer = FloatAudioBuffer(data.data, data.len, offset, our_volume, pan); - shared_ptr voice_effect = (*i)->getEffect(); + boost::shared_ptr voice_effect = (*i)->getEffect(); if (voice_effect) { std::vector newbuffers; newbuffers.push_back(voicebuffer); @@ -658,7 +658,7 @@ void MusicAleotoricLayer::update(unsigned int latency) { next_offset = offset; } -MusicLoopLayer::MusicLoopLayer(MNGLoopLayerNode *n, shared_ptr p) : MusicLayer(p) { +MusicLoopLayer::MusicLoopLayer(MNGLoopLayerNode *n, boost::shared_ptr p) : MusicLayer(p) { node = n; update_period = 0; } @@ -670,7 +670,7 @@ void MusicLoopLayer::init() { MNGWaveNode *e = dynamic_cast(n); if (e) { // TODO: share duplicate MusicWaves - wave = shared_ptr(new MusicWave(parent->getParent(), e)); + wave = boost::shared_ptr(new MusicWave(parent->getParent(), e)); continue; } @@ -743,7 +743,7 @@ void MusicTrack::init() { MNGAleotoricLayerNode *al = dynamic_cast(n); if (al) { MusicAleotoricLayer *ptr = new MusicAleotoricLayer(al, shared_from_this()); - shared_ptr mal(ptr); + boost::shared_ptr mal(ptr); ptr->init(); layers.push_back(mal); continue; @@ -752,7 +752,7 @@ void MusicTrack::init() { MNGLoopLayerNode *ll = dynamic_cast(n); if (ll) { MusicLoopLayer *ptr = new MusicLoopLayer(ll, shared_from_this()); - shared_ptr mll(ptr); + boost::shared_ptr mll(ptr); ptr->init(); layers.push_back(mll); continue; @@ -790,7 +790,7 @@ MusicTrack::~MusicTrack() { } void MusicTrack::update(unsigned int latency) { - for (std::vector >::iterator i = layers.begin(); i != layers.end(); i++) { + for (std::vector >::iterator i = layers.begin(); i != layers.end(); i++) { (*i)->update(latency); } } diff --git a/src/PathResolver.cpp b/src/PathResolver.cpp index 0d6905df..c365fbb3 100644 --- a/src/PathResolver.cpp +++ b/src/PathResolver.cpp @@ -48,13 +48,13 @@ static string toLowerCase(string in) { } static path lcpath(path &orig) { - return path(toLowerCase(orig.string()), native); + return path(toLowerCase(orig.string())); } static path lcleaf(path &orig) { path br, leaf; - br = orig.branch_path(); - leaf = path(toLowerCase(orig.leaf()), native); + br = orig.parent_path(); + leaf = path(toLowerCase(orig.filename().string())); return br / leaf; } @@ -68,7 +68,7 @@ bool resolveFile(path &p) { if (!resolveFile(s)) return false; } - p = path(s, native); + p = path(s); return true; #else return exists(p); @@ -76,20 +76,21 @@ bool resolveFile(path &p) { } bool resolveFile_(string &srcPath) { - path orig(srcPath, native); + path orig(srcPath); + if (exists(orig)) return true; orig.normalize(); - path dir = orig.branch_path(); - path leaf = path(orig.leaf(), native); + path dir = orig.parent_path(); + path leaf = orig.filename(); if (!checkDirCache(dir)) return false; orig = dir / lcpath(leaf); string fn = orig.string(); - + if (exists(orig)) { srcPath = fn; return true; @@ -180,7 +181,7 @@ std::vector findByWildcard(std::string dir, std::string wild) { wild = toLowerCase(wild); - path dirp(dir, native); + path dirp(dir); dirp.normalize(); if (!resolveFile(dirp)) return std::vector(); diff --git a/src/World.cpp b/src/World.cpp index 3faa5ad7..a18e0d96 100644 --- a/src/World.cpp +++ b/src/World.cpp @@ -515,7 +515,7 @@ void World::executeInitScript(fs::path p) { assert(fs::exists(p)); assert(!fs::is_directory(p)); - std::string x = p.native_file_string(); + std::string x = p.string(); std::ifstream s(x.c_str()); assert(s.is_open()); //std::cout << "executing script " << x << "...\n"; @@ -527,9 +527,9 @@ void World::executeInitScript(fs::path p) { script.installScripts(); vm.runEntirely(script.installer); } catch (creaturesException &e) { - std::cerr << "exec of \"" << p.leaf() << "\" failed due to exception " << e.prettyPrint() << std::endl; + std::cerr << "exec of \"" << p.string() << "\" failed due to exception " << e.prettyPrint() << std::endl; } catch (std::exception &e) { - std::cerr << "exec of \"" << p.leaf() << "\" failed due to exception " << e.what() << std::endl; + std::cerr << "exec of \"" << p.string() << "\" failed due to exception " << e.what() << std::endl; } std::cout.flush(); std::cerr.flush(); } @@ -564,7 +564,7 @@ void World::executeBootstrap(bool switcher) { fs::path edenpath(data_directories[0] / "/Eden.sfc"); if (fs::exists(edenpath) && !fs::is_directory(edenpath)) { SFCFile sfc; - std::ifstream f(edenpath.native_directory_string().c_str(), std::ios::binary); + std::ifstream f(edenpath.string().c_str(), std::ios::binary); f >> std::noskipws; sfc.read(&f); sfc.copyToWorld(); @@ -585,7 +585,7 @@ void World::executeBootstrap(bool switcher) { // iterate through each bootstrap directory for (fs::directory_iterator d(b); d != fsend; ++d) { if (fs::exists(*d) && fs::is_directory(*d)) { - std::string s = d->path().leaf(); + std::string s = d->path().filename().string(); // TODO: cvillage has switcher code in 'Startup', so i included it here too if (s == "000 Switcher" || s == "Startup") { if (!switcher) continue; @@ -620,7 +620,7 @@ std::string World::findFile(std::string name) { // Go backwards, so we find files in more 'modern' directories first.. for (int i = data_directories.size() - 1; i != -1; i--) { fs::path p = data_directories[i]; - std::string r = (p / fs::path(name, fs::native)).native_directory_string(); + std::string r = (p / fs::path(name)).string(); if (resolveFile(r)) return r; } @@ -634,7 +634,7 @@ std::vector World::findFiles(std::string dir, std::string wild) { // Go backwards, so we find files in more 'modern' directories first.. for (int i = data_directories.size() - 1; i != -1; i--) { fs::path p = data_directories[i]; - std::string r = (p / fs::path(dir, fs::native)).native_directory_string(); + std::string r = (p / fs::path(dir)).string(); std::vector results = findByWildcard(r, wild); possibles.insert(possibles.end(), results.begin(), results.end()); // merge results } @@ -643,7 +643,7 @@ std::vector World::findFiles(std::string dir, std::string wild) { } std::string World::getUserDataDir() { - return (data_directories.end() - 1)->native_directory_string(); + return (data_directories.end() - 1)->string(); } void World::selectCreature(boost::shared_ptr a) { diff --git a/src/backends/qtgui/AgentInjector.cpp b/src/backends/qtgui/AgentInjector.cpp index 2510368b..31ca57de 100644 --- a/src/backends/qtgui/AgentInjector.cpp +++ b/src/backends/qtgui/AgentInjector.cpp @@ -97,7 +97,7 @@ void AgentInjector::readAgents() { std::transform(cobext.begin(), cobext.end(), cobext.begin(), (int(*)(int))tolower); // downcase if (cobext != ".cob") continue; - std::string cob = itr->path().native_file_string(); + std::string cob = itr->path().string(); if (engine.version == 1) { std::ifstream cobstream(cob.c_str(), std::ios::binary); @@ -166,8 +166,8 @@ void AgentInjector::onInject() { std::string directory = world.praymanager.getResourceDir(praytype); caos_assert(!directory.empty()); - fs::path possiblefile = fs::path(directory, fs::native) / fs::path(name, fs::native); - if (!world.findFile(possiblefile.native_directory_string()).empty()) continue; // TODO: update file if necessary? + fs::path possiblefile = fs::path(directory) / fs::path(name); + if (!world.findFile(possiblefile.string()).empty()) continue; // TODO: update file if necessary? std::vector::iterator j; @@ -179,15 +179,15 @@ void AgentInjector::onInject() { cobFileBlock *a = new cobFileBlock(*j); if (a->filetype == type && a->filename == name) { // Found dependency! - fs::path dir = fs::path(world.getUserDataDir(), fs::native) / fs::path(directory, fs::native); + fs::path dir = fs::path(world.getUserDataDir()) / fs::path(directory); if (!fs::exists(dir)) fs::create_directory(dir); assert(fs::exists(dir) && fs::is_directory(dir)); // TODO: error handling - fs::path outputfile = dir / fs::path(name, fs::native); + fs::path outputfile = dir / fs::path(name); assert(!fs::exists(outputfile)); - std::ofstream output(outputfile.native_directory_string().c_str(), std::ios::binary); + std::ofstream output(outputfile.string().c_str(), std::ios::binary); output.write((char *)a->getFileContents(), a->filesize); a->getParent()->free(); diff --git a/src/caos/caosVM_core.cpp b/src/caos/caosVM_core.cpp index 3aa46294..ed0f9326 100644 --- a/src/caos/caosVM_core.cpp +++ b/src/caos/caosVM_core.cpp @@ -346,7 +346,7 @@ void caosVM::v_OC2E_DDIR() { for (std::vector::iterator i = world.data_directories.begin(); i != world.data_directories.end(); i++) { boost::filesystem::path &p = *i; - d = d + boost::filesystem::system_complete(p).native_file_string() + "\n"; + d = d + boost::filesystem::system_complete(p).string() + "\n"; } result.setString(d); diff --git a/src/caos/caosVM_files.cpp b/src/caos/caosVM_files.cpp index 8875f53f..c23271eb 100644 --- a/src/caos/caosVM_files.cpp +++ b/src/caos/caosVM_files.cpp @@ -59,7 +59,7 @@ std::string calculateJournalFilename(int directory, std::string filename, bool w default: throw caosException("unknown Journal directory"); } - fs::path dir = fs::path(fullfilename, fs::native); + fs::path dir = fs::path(fullfilename); if (!fs::exists(dir)) fs::create_directory(dir); caos_assert(fs::exists(dir) && fs::is_directory(dir)); diff --git a/src/caos/caosVM_resources.cpp b/src/caos/caosVM_resources.cpp index 4053d181..af5145a8 100644 --- a/src/caos/caosVM_resources.cpp +++ b/src/caos/caosVM_resources.cpp @@ -29,19 +29,19 @@ bool prayInstall(std::string name, unsigned int type, bool actually_install) { std::string directory = world.praymanager.getResourceDir(type); caos_assert(!directory.empty()); - fs::path dir = fs::path(world.getUserDataDir(), fs::native) / fs::path(directory, fs::native); + fs::path dir = fs::path(world.getUserDataDir()) / fs::path(directory); if (!fs::exists(dir)) fs::create_directory(dir); caos_assert(fs::exists(dir) && fs::is_directory(dir)); - fs::path outputfile = dir / fs::path(name, fs::native); + fs::path outputfile = dir / fs::path(name); if (fs::exists(outputfile)) { // TODO: update file if necessary? check it's not a directory :P return true; } - fs::path possiblefile = fs::path(directory, fs::native) / fs::path(name, fs::native); - if (!world.findFile(possiblefile.native_directory_string()).empty()) { + fs::path possiblefile = fs::path(directory) / fs::path(name); + if (!world.findFile(possiblefile.string()).empty()) { // TODO: we need to return 'okay' if the file exists anywhere, but someone needs to work out update behaviour (see other comment above, also) return true; } @@ -65,7 +65,7 @@ bool prayInstall(std::string name, unsigned int type, bool actually_install) { } p->load(); - std::ofstream output(outputfile.native_directory_string().c_str(), std::ios::binary); + std::ofstream output(outputfile.string().c_str(), std::ios::binary); output.write((char *)p->getBuffer(), p->getSize()); // p->unload(); diff --git a/src/caosScript.cpp b/src/caosScript.cpp index fabdb14a..794d8400 100644 --- a/src/caosScript.cpp +++ b/src/caosScript.cpp @@ -108,6 +108,7 @@ std::string script::dump() { caosScript::caosScript(const std::string &dialect, const std::string &fn) { enumdepth = 0; d = dialects[dialect].get(); + if (!d) throw parseException(std::string("Unknown dialect ") + dialect); current = installer = shared_ptr