Added some debug output to get more info for #1464 (unnecessary download

of addon icons). To be removed later.
This commit is contained in:
hiker 2014-08-22 12:44:46 +10:00
parent 0e23c54562
commit 80e1effccf
2 changed files with 20 additions and 8 deletions

View File

@ -350,6 +350,25 @@ FileManager::~FileManager()
m_file_system = NULL;
} // ~FileManager
// ----------------------------------------------------------------------------
/** Returns true if the specified file exists.
*/
bool FileManager::fileExists(const std::string& path) const
{
#ifdef DEBUG
bool exists = m_file_system->existFile(path.c_str());
if(exists) return true;
// Now the original file was not found. Test if replacing \ with / helps:
std::string s = StringUtils::replace(path, "\\", "/");
exists = m_file_system->existFile(s.c_str());
if(exists)
Log::warn("FileManager", "File '%s' does not exists, but '%s' does!",
path.c_str(), s.c_str());
return exists;
#else
return m_file_system->existFile(path.c_str());
#endif
} // fileExists
//-----------------------------------------------------------------------------
/** Adds paths to the list of stk root directories.
* \param roots A ":" separated string of directories to add.

View File

@ -133,6 +133,7 @@ public:
std::string searchMusic(const std::string& file_name) const;
std::string searchTexture(const std::string& fname) const;
std::string getUserConfigFile(const std::string& fname) const;
bool fileExists(const std::string& path) const;
void listFiles (std::set<std::string>& result,
const std::string& dir,
bool make_full_path=false) const;
@ -155,14 +156,6 @@ public:
m_music_search_path.push_back(path);
} // pushMusicSearchPath
// ------------------------------------------------------------------------
/** Returns true if the specified file exists.
*/
bool fileExists(const std::string& path) const
{
return m_file_system->existFile(path.c_str());
} // fileExists
}; // FileManager
extern FileManager* file_manager;