diff --git a/src/client/creatures.cpp b/src/client/creatures.cpp index 314b5891..e925002e 100644 --- a/src/client/creatures.cpp +++ b/src/client/creatures.cpp @@ -26,7 +26,6 @@ #include #include -#include CreatureManager g_creatures; @@ -196,6 +195,8 @@ void CreatureManager::loadNpcs(const std::string& folder) if(!stdext::ends_with(tmp, "/")) tmp += "/"; + // FIXME: filesystem is not supported anymore, rework the following code with g_resources + /* boost::filesystem::path npcPath(boost::filesystem::current_path().generic_string() + tmp); if(!boost::filesystem::exists(npcPath)) stdext::throw_exception(stdext::format("NPCs folder '%s' was not found.", folder)); @@ -207,6 +208,7 @@ void CreatureManager::loadNpcs(const std::string& folder) loadCreatureBuffer(g_resources.readFileContents(tmp + f)); } + */ } void CreatureManager::loadSpawns(const std::string& fileName) diff --git a/src/framework/CMakeLists.txt b/src/framework/CMakeLists.txt index b5c1f647..24f6c7d8 100644 --- a/src/framework/CMakeLists.txt +++ b/src/framework/CMakeLists.txt @@ -184,7 +184,7 @@ message(STATUS "Build revision: ${BUILD_REVISION}") add_definitions(-D"BUILD_REVISION=\\\"${BUILD_REVISION}\\\"") # find boost -set(REQUIRED_BOOST_COMPONENTS system filesystem thread chrono) +set(REQUIRED_BOOST_COMPONENTS system thread chrono) if(WIN32) set(Boost_THREADAPI win32) set(framework_DEFINITIONS ${framework_DEFINITIONS} -DBOOST_THREAD_USE_LIB) # fix boost thread linkage diff --git a/src/framework/core/application.cpp b/src/framework/core/application.cpp index 29a0df7a..194a56fa 100644 --- a/src/framework/core/application.cpp +++ b/src/framework/core/application.cpp @@ -31,9 +31,6 @@ #include #include -#include -#include -#include #include #ifdef FW_NET @@ -75,8 +72,6 @@ void Application::init(std::vector& args) // setup locale std::locale::global(std::locale()); - std::locale utf8("en_US.UTF-8"); - boost::filesystem::path::imbue(utf8); // process args encoding g_platform.processArgs(args); diff --git a/src/framework/core/resourcemanager.cpp b/src/framework/core/resourcemanager.cpp index 87ccc069..e0f1f56c 100644 --- a/src/framework/core/resourcemanager.cpp +++ b/src/framework/core/resourcemanager.cpp @@ -25,9 +25,9 @@ #include #include +#include #include -#include ResourceManager g_resources; @@ -298,7 +298,7 @@ std::string ResourceManager::getRealDir(const std::string& path) std::string ResourceManager::getCurrentDir() { - return boost::filesystem::current_path().generic_string() + "/"; + return g_platform.getCurrentDir(); } std::string ResourceManager::getBaseDir() diff --git a/src/framework/platform/platform.h b/src/framework/platform/platform.h index c12bf445..992f6fd4 100644 --- a/src/framework/platform/platform.h +++ b/src/framework/platform/platform.h @@ -35,6 +35,7 @@ public: bool isProcessRunning(const std::string& name); bool killProcess(const std::string& name); std::string getTempPath(); + std::string getCurrentDir(); bool copyFile(std::string from, std::string to); bool fileExists(const std::string& file); void openUrl(std::string url); diff --git a/src/framework/platform/unixplatform.cpp b/src/framework/platform/unixplatform.cpp index c6f053c4..2d7dd513 100644 --- a/src/framework/platform/unixplatform.cpp +++ b/src/framework/platform/unixplatform.cpp @@ -79,6 +79,15 @@ std::string Platform::getTempPath() return "/tmp/"; } +std::string Platform::getCurrentDir() +{ + std::string res; + char cwd[2048]; + if(getcwd(cwd, sizeof(cwd)) != NULL) + res = cwd; + return res; +} + bool Platform::copyFile(std::string from, std::string to) { return system(stdext::format("/bin/cp '%s' '%s'", from, to).c_str()) == 0; diff --git a/src/framework/platform/win32platform.cpp b/src/framework/platform/win32platform.cpp index 37da156c..f58daaf2 100644 --- a/src/framework/platform/win32platform.cpp +++ b/src/framework/platform/win32platform.cpp @@ -88,6 +88,16 @@ std::string Platform::getTempPath() return stdext::utf16_to_utf8(path); } +std::string Platform::getCurrentDir() +{ + std::string ret; + wchar_t path[MAX_PATH]; + GetCurrentDirectoryW(MAX_PATH, path); + ret = stdext::utf16_to_utf8(path); + boost::replace_all(ret, "\\", "/"); + return ret; +} + bool Platform::fileExists(const std::string& file) { std::wstring wfile = stdext::utf8_to_utf16(file);