From 2aaa0f4578976fb09c05a2cfa1a70a777ad33806 Mon Sep 17 00:00:00 2001 From: Jason Hooks Date: Sat, 4 Jun 2011 01:29:57 -0400 Subject: [PATCH] Backslash working in linux --- apps/openmw/engine.cpp | 2 ++ apps/openmw/mwclass/npc.cpp | 2 +- components/bsa/bsa_archive.cpp | 24 ++++++++++++++++++++++++ 3 files changed, 27 insertions(+), 1 deletion(-) diff --git a/apps/openmw/engine.cpp b/apps/openmw/engine.cpp index 5c51ab513..a899a5aea 100644 --- a/apps/openmw/engine.cpp +++ b/apps/openmw/engine.cpp @@ -300,6 +300,8 @@ void OMW::Engine::loadBSA() std::string m = mDataDir.string(); std::cout << "Data dir" << m << "\n"; addDir(m); + //std::string s = "f\n"; + //std::cout <<"S: " << s.size() << "\n"; } diff --git a/apps/openmw/mwclass/npc.cpp b/apps/openmw/mwclass/npc.cpp index 6fab8841a..c6d092253 100644 --- a/apps/openmw/mwclass/npc.cpp +++ b/apps/openmw/mwclass/npc.cpp @@ -118,7 +118,7 @@ namespace MWClass Ogre::Vector3 pos2 = Ogre::Vector3( 0, .5, 75); if (groin){ - //cellRender.insertMesh("Meshes/bald_MJ_hat.NIF"); //w/W_6th_Hammer.NIF + cellRender.insertMesh("Meshes\\bald_MJ_hat.NIF"); //w/W_6th_Hammer.NIF //bald_MJ_hat.NIF cellRender.insertMesh("meshes\\" + groin->model, pos2, axis, kOgrePi, npcName + "groin", addresses, numbers); addresses2[numbers] = npcName + "groin"; diff --git a/components/bsa/bsa_archive.cpp b/components/bsa/bsa_archive.cpp index 552084c41..93bde48e3 100644 --- a/components/bsa/bsa_archive.cpp +++ b/components/bsa/bsa_archive.cpp @@ -49,9 +49,33 @@ class DirArchive: public Ogre::FileSystemArchive void load() {} void unload() {} + bool exists(const String& filename) { + std::string copy = filename; + if(OGRE_PLATFORM != OGRE_PLATFORM_WIN32) + { + + for (int i = 0; i < filename.size(); i++) + { + if(copy.at(i) == '\\' ){ + copy.replace(i, 1, "/"); + } + } + } + return FileSystemArchive::exists(copy); + } + DataStreamPtr open(const String& filename, bool readonly = true) const { std::string copy = filename; + if(OGRE_PLATFORM != OGRE_PLATFORM_WIN32){ + //std::cout << "In Open\n"; + for (int i = 0; i < filename.size(); i++) + { + if(copy.at(i) == '\\' ){ + copy.replace(i, 1, "/"); + } + } + } return FileSystemArchive::open(copy, readonly); }