[colobot] 107/145: Remove part of boost::filesystem usage.

Didier Raboud odyx at moszumanska.debian.org
Mon Jul 11 12:56:22 UTC 2016


This is an automated email from the git hooks/post-receive script.

odyx pushed a commit to branch debian/master
in repository colobot.

commit 2168b57cac9e20738718e323cf55ff3dbf9c733b
Author: Krzysztof Dermont <erihel at gmail.com>
Date:   Sun Apr 10 21:48:19 2016 +0200

    Remove part of boost::filesystem usage.
---
 src/app/app.cpp                          |  1 -
 src/common/resources/resourcemanager.cpp | 20 +++++---------------
 src/sound/oalsound/alsound.cpp           |  6 ------
 src/sound/sound.cpp                      |  2 --
 4 files changed, 5 insertions(+), 24 deletions(-)

diff --git a/src/app/app.cpp b/src/app/app.cpp
index c1439ff..d34532f 100644
--- a/src/app/app.cpp
+++ b/src/app/app.cpp
@@ -47,7 +47,6 @@
     #include "sound/oalsound/alsound.h"
 #endif
 
-#include <boost/filesystem.hpp>
 #include <boost/tokenizer.hpp>
 
 #include <SDL.h>
diff --git a/src/common/resources/resourcemanager.cpp b/src/common/resources/resourcemanager.cpp
index 94326a9..9130b88 100644
--- a/src/common/resources/resourcemanager.cpp
+++ b/src/common/resources/resourcemanager.cpp
@@ -152,27 +152,17 @@ bool CResourceManager::CreateDirectory(const std::string& directory)
     return false;
 }
 
-//TODO: Don't use boost::filesystem here
 bool CResourceManager::RemoveDirectory(const std::string& directory)
 {
     if (PHYSFS_isInit())
     {
-        bool success = true;
-        std::string writeDir = PHYSFS_getWriteDir();
-        try
+        std::string path = CleanPath(directory);
+        for (auto file : ListFiles(path))
         {
-            std::string path = writeDir + "/" + CleanPath(directory);
-            #if PLATFORM_WINDOWS
-            fs::remove_all(CSystemUtilsWindows::UTF8_Decode(path));
-            #else
-            fs::remove_all(path);
-            #endif
+            if (PHYSFS_delete((path + "/" + file).c_str()) == 0)
+                return false;
         }
-        catch (std::exception&)
-        {
-            success = false;
-        }
-        return success;
+        return PHYSFS_delete(path.c_str()) != 0;
     }
     return false;
 }
diff --git a/src/sound/oalsound/alsound.cpp b/src/sound/oalsound/alsound.cpp
index 95b49a9..cfa335d 100644
--- a/src/sound/oalsound/alsound.cpp
+++ b/src/sound/oalsound/alsound.cpp
@@ -25,7 +25,6 @@
 #include <algorithm>
 #include <iomanip>
 
-#include <boost/filesystem.hpp>
 
 CALSound::CALSound()
     : 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())
     {
         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>();
         buffer = newBuffer.get();
diff --git a/src/sound/sound.cpp b/src/sound/sound.cpp
index d22523f..3640c58 100644
--- a/src/sound/sound.cpp
+++ b/src/sound/sound.cpp
@@ -27,8 +27,6 @@
 #include <iomanip>
 #include <sstream>
 
-#include <boost/filesystem.hpp>
-
 
 CSoundInterface::CSoundInterface()
 {

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/colobot.git



More information about the Pkg-games-commits mailing list