Remove part of boost::filesystem usage.

master
Krzysztof Dermont 2016-04-10 21:48:19 +02:00
parent b56cd11c98
commit 2168b57cac
4 changed files with 5 additions and 24 deletions

View File

@ -47,7 +47,6 @@
#include "sound/oalsound/alsound.h" #include "sound/oalsound/alsound.h"
#endif #endif
#include <boost/filesystem.hpp>
#include <boost/tokenizer.hpp> #include <boost/tokenizer.hpp>
#include <SDL.h> #include <SDL.h>

View File

@ -152,27 +152,17 @@ bool CResourceManager::CreateDirectory(const std::string& directory)
return false; return false;
} }
//TODO: Don't use boost::filesystem here
bool CResourceManager::RemoveDirectory(const std::string& directory) bool CResourceManager::RemoveDirectory(const std::string& directory)
{ {
if (PHYSFS_isInit()) if (PHYSFS_isInit())
{ {
bool success = true; std::string path = CleanPath(directory);
std::string writeDir = PHYSFS_getWriteDir(); for (auto file : ListFiles(path))
try
{ {
std::string path = writeDir + "/" + CleanPath(directory); if (PHYSFS_delete((path + "/" + file).c_str()) == 0)
#if PLATFORM_WINDOWS return false;
fs::remove_all(CSystemUtilsWindows::UTF8_Decode(path));
#else
fs::remove_all(path);
#endif
} }
catch (std::exception&) return PHYSFS_delete(path.c_str()) != 0;
{
success = false;
}
return success;
} }
return false; return false;
} }

View File

@ -25,7 +25,6 @@
#include <algorithm> #include <algorithm>
#include <iomanip> #include <iomanip>
#include <boost/filesystem.hpp>
CALSound::CALSound() CALSound::CALSound()
: m_enabled(false), : m_enabled(false),
@ -586,11 +585,6 @@ bool CALSound::PlayMusic(const std::string &filename, bool repeat, float fadeTim
if (m_music.find(filename) == m_music.end()) if (m_music.find(filename) == m_music.end())
{ {
GetLogger()->Debug("Music %s was not cached!\n", filename.c_str()); GetLogger()->Debug("Music %s was not cached!\n", filename.c_str());
/* TODO: if (!boost::filesystem::exists(filename))
{
GetLogger()->Debug("Requested music %s was not found.\n", filename.c_str());
return false;
} */
auto newBuffer = MakeUnique<CBuffer>(); auto newBuffer = MakeUnique<CBuffer>();
buffer = newBuffer.get(); buffer = newBuffer.get();

View File

@ -27,8 +27,6 @@
#include <iomanip> #include <iomanip>
#include <sstream> #include <sstream>
#include <boost/filesystem.hpp>
CSoundInterface::CSoundInterface() CSoundInterface::CSoundInterface()
{ {