From bd9648aa6007bab95670430243df439ae646caaa Mon Sep 17 00:00:00 2001 From: fgenesis Date: Mon, 12 Mar 2012 03:13:34 +0100 Subject: [PATCH] Fix particle & shot loading on linux (fix file name case) --- Aquaria/Shot.cpp | 8 +++++--- BBGE/Base.cpp | 4 ++-- BBGE/ParticleEffect.cpp | 1 + 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/Aquaria/Shot.cpp b/Aquaria/Shot.cpp index fa0473e..9bde459 100644 --- a/Aquaria/Shot.cpp +++ b/Aquaria/Shot.cpp @@ -64,7 +64,7 @@ ShotData::ShotData() ignoreShield = false; } -void readEquals2(std::ifstream &in) +template void readEquals2(T &in) { std::string temp; in >> temp; @@ -93,7 +93,10 @@ void ShotData::bankLoad(const std::string &file, const std::string &path) } debugLog(usef); - std::ifstream inf(usef.c_str()); + char *data = readFile(core->adjustFilenameCase(usef).c_str()); + if (!data) + return; + SimpleIStringStream inf(data, SimpleIStringStream::TAKE_OVER); std::string token; while (inf >> token) { @@ -241,7 +244,6 @@ void ShotData::bankLoad(const std::string &file, const std::string &path) } - inf.close(); } void Shot::fire(bool playSfx) diff --git a/BBGE/Base.cpp b/BBGE/Base.cpp index ebe3257..132f049 100644 --- a/BBGE/Base.cpp +++ b/BBGE/Base.cpp @@ -555,8 +555,8 @@ void forEachFile(std::string path, std::string type, void callback(const std::st { if (path.empty()) return; - stringToLowerUserData(path); - stringToLower(type); + path = core->adjustFilenameCase(path); + stringToLower(type); //HACK: MAC: debugLog("forEachFile - path: " + path + " type: " + type); diff --git a/BBGE/ParticleEffect.cpp b/BBGE/ParticleEffect.cpp index 0122a03..821fc3b 100644 --- a/BBGE/ParticleEffect.cpp +++ b/BBGE/ParticleEffect.cpp @@ -96,6 +96,7 @@ void ParticleEffect::bankLoad(const std::string &file, const std::string &path) clearEmitters(); + usef = core->adjustFilenameCase(usef); debugLog(usef); char *buffer = readFile(usef); if (!buffer)