From f5ba2a27d4422401317d814c60048121f9804429 Mon Sep 17 00:00:00 2001 From: Mohamed Waheed Date: Tue, 24 Jun 2014 20:31:17 +0300 Subject: fixed savefile screenshot loading bug --- src/app/gamedata.cpp | 35 ++++++++++++++++------------------- 1 file changed, 16 insertions(+), 19 deletions(-) (limited to 'src/app/gamedata.cpp') diff --git a/src/app/gamedata.cpp b/src/app/gamedata.cpp index 1bf3f36..05c0242 100644 --- a/src/app/gamedata.cpp +++ b/src/app/gamedata.cpp @@ -78,16 +78,22 @@ std::string CGameData::GetFilePath(DataDir dir, const std::string& subpath) for(std::vector::reverse_iterator rit = m_dataDirs.rbegin(); rit != m_dataDirs.rend(); ++rit) { std::stringstream str; - str << *rit; - str << "/"; - str << m_standardDataDirs[index]; - if (dir == DIR_HELP) - { + + if ( subpath.find("save") == std::string::npos ){ // if its NOT a path to a savefile screenshot + str << *rit; + str << "/"; + str << m_standardDataDirs[index]; + + if (dir == DIR_HELP) + { + str << "/"; + str << CApplication::GetInstancePointer()->GetLanguageChar(); + } str << "/"; - str << CApplication::GetInstancePointer()->GetLanguageChar(); } - str << "/"; + str << subpath; + boost::filesystem::path path(str.str()); if(boost::filesystem::exists(path)) { @@ -95,18 +101,9 @@ std::string CGameData::GetFilePath(DataDir dir, const std::string& subpath) } } - std::stringstream str; - str << m_dataDirs[0]; - str << "/"; - str << m_standardDataDirs[index]; - if (dir == DIR_HELP) - { - str << "/"; - str << CApplication::GetInstancePointer()->GetLanguageChar(); - } - str << "/"; - str << subpath; - return str.str(); + GetLogger()->Error("file subpath error\n"); + + return ""; } std::string CGameData::GetDataPath(const std::string &subpath) -- cgit v1.2.3-1-g7c22