parent
550193e570
commit
0ef77132a0
|
@ -334,7 +334,7 @@ set(Boost_USE_MULTITHREADED ON)
|
||||||
set(Boost_USE_STATIC_RUNTIME ${USE_STATIC_RUNTIME})
|
set(Boost_USE_STATIC_RUNTIME ${USE_STATIC_RUNTIME})
|
||||||
|
|
||||||
set(Boost_ADDITIONALVERSION "1.51" "1.51.0")
|
set(Boost_ADDITIONALVERSION "1.51" "1.51.0")
|
||||||
find_package(Boost COMPONENTS system filesystem regex REQUIRED)
|
find_package(Boost COMPONENTS system regex REQUIRED)
|
||||||
|
|
||||||
set(GLEW_USE_STATIC_LIBS ${GLEW_STATIC})
|
set(GLEW_USE_STATIC_LIBS ${GLEW_STATIC})
|
||||||
find_package(GLEW REQUIRED)
|
find_package(GLEW REQUIRED)
|
||||||
|
|
|
@ -504,7 +504,6 @@ target_link_libraries(colobotbase PUBLIC
|
||||||
GLEW::GLEW
|
GLEW::GLEW
|
||||||
glm::glm
|
glm::glm
|
||||||
Boost::headers
|
Boost::headers
|
||||||
Boost::filesystem
|
|
||||||
Boost::regex
|
Boost::regex
|
||||||
PhysFS::PhysFS
|
PhysFS::PhysFS
|
||||||
SndFile::sndfile
|
SndFile::sndfile
|
||||||
|
|
|
@ -32,12 +32,10 @@
|
||||||
#include "level/parser/parser.h"
|
#include "level/parser/parser.h"
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
#include <filesystem>
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <boost/filesystem.hpp>
|
|
||||||
#include <boost/algorithm/string.hpp>
|
#include <boost/algorithm/string.hpp>
|
||||||
|
|
||||||
using namespace boost::filesystem;
|
|
||||||
|
|
||||||
CModManager::CModManager(CApplication* app, CPathManager* pathManager)
|
CModManager::CModManager(CApplication* app, CPathManager* pathManager)
|
||||||
: m_app{app},
|
: m_app{app},
|
||||||
m_pathManager{pathManager}
|
m_pathManager{pathManager}
|
||||||
|
@ -74,7 +72,7 @@ void CModManager::FindMods()
|
||||||
std::map<std::string, std::string> modPaths;
|
std::map<std::string, std::string> modPaths;
|
||||||
for (const auto& path : rawPaths)
|
for (const auto& path : rawPaths)
|
||||||
{
|
{
|
||||||
auto modName = boost::filesystem::path(path).stem().string();
|
auto modName = std::filesystem::path(path).stem().string();
|
||||||
modPaths.insert(std::make_pair(modName, path));
|
modPaths.insert(std::make_pair(modName, path));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,24 +18,23 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#include "app/app.h"
|
||||||
#include "app/pathman.h"
|
#include "app/pathman.h"
|
||||||
|
|
||||||
#include "common/config.h"
|
#include "common/config.h"
|
||||||
|
|
||||||
#include "app/app.h"
|
|
||||||
|
|
||||||
|
|
||||||
#include "common/logger.h"
|
#include "common/logger.h"
|
||||||
|
|
||||||
#include "common/resources/resourcemanager.h"
|
#include "common/resources/resourcemanager.h"
|
||||||
|
|
||||||
#include "common/system/system.h"
|
#include "common/system/system.h"
|
||||||
|
|
||||||
#ifdef PLATFORM_WINDOWS
|
#ifdef PLATFORM_WINDOWS
|
||||||
#include "common/system/system_windows.h"
|
#include "common/system/system_windows.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <boost/algorithm/string.hpp>
|
#include <boost/algorithm/string.hpp>
|
||||||
#include <boost/filesystem.hpp>
|
|
||||||
|
#include <filesystem>
|
||||||
|
|
||||||
CPathManager::CPathManager(CSystemUtils* systemUtils)
|
CPathManager::CPathManager(CSystemUtils* systemUtils)
|
||||||
: m_dataPath(systemUtils->GetDataPath())
|
: m_dataPath(systemUtils->GetDataPath())
|
||||||
|
@ -81,12 +80,9 @@ const std::string& CPathManager::GetSavePath()
|
||||||
|
|
||||||
std::string CPathManager::VerifyPaths()
|
std::string CPathManager::VerifyPaths()
|
||||||
{
|
{
|
||||||
#if PLATFORM_WINDOWS
|
std::filesystem::path dataPath = std::filesystem::u8path(m_dataPath);
|
||||||
boost::filesystem::path dataPath(CSystemUtilsWindows::UTF8_Decode(m_dataPath));
|
|
||||||
#else
|
if (! (std::filesystem::exists(dataPath) && std::filesystem::is_directory(dataPath)) )
|
||||||
boost::filesystem::path dataPath(m_dataPath);
|
|
||||||
#endif
|
|
||||||
if (! (boost::filesystem::exists(dataPath) && boost::filesystem::is_directory(dataPath)) )
|
|
||||||
{
|
{
|
||||||
GetLogger()->Error("Data directory '%s' doesn't exist or is not a directory\n", m_dataPath.c_str());
|
GetLogger()->Error("Data directory '%s' doesn't exist or is not a directory\n", m_dataPath.c_str());
|
||||||
return std::string("Could not read from data directory:\n") +
|
return std::string("Could not read from data directory:\n") +
|
||||||
|
@ -94,23 +90,15 @@ std::string CPathManager::VerifyPaths()
|
||||||
std::string("Please check your installation, or supply a valid data directory by -datadir option.");
|
std::string("Please check your installation, or supply a valid data directory by -datadir option.");
|
||||||
}
|
}
|
||||||
|
|
||||||
#if PLATFORM_WINDOWS
|
std::filesystem::path langPath = std::filesystem::u8path(m_langPath);
|
||||||
boost::filesystem::path langPath(CSystemUtilsWindows::UTF8_Decode(m_langPath));
|
|
||||||
#else
|
if (! (std::filesystem::exists(langPath) && std::filesystem::is_directory(langPath)) )
|
||||||
boost::filesystem::path langPath(m_langPath);
|
|
||||||
#endif
|
|
||||||
if (! (boost::filesystem::exists(langPath) && boost::filesystem::is_directory(langPath)) )
|
|
||||||
{
|
{
|
||||||
GetLogger()->Warn("Language path '%s' is invalid, assuming translation files not installed\n", m_langPath.c_str());
|
GetLogger()->Warn("Language path '%s' is invalid, assuming translation files not installed\n", m_langPath.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
#if PLATFORM_WINDOWS
|
std::filesystem::create_directories(std::filesystem::u8path(m_savePath));
|
||||||
boost::filesystem::create_directories(CSystemUtilsWindows::UTF8_Decode(m_savePath));
|
std::filesystem::create_directories(std::filesystem::u8path(m_savePath + "/mods"));
|
||||||
boost::filesystem::create_directories(CSystemUtilsWindows::UTF8_Decode(m_savePath+"/mods"));
|
|
||||||
#else
|
|
||||||
boost::filesystem::create_directories(m_savePath);
|
|
||||||
boost::filesystem::create_directories(m_savePath+"/mods");
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
@ -159,9 +147,10 @@ std::vector<std::string> CPathManager::FindMods() const
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
GetLogger()->Info("Additional mod paths:\n");
|
GetLogger()->Info("Additional mod paths:\n");
|
||||||
|
|
||||||
for (const auto& modPath : m_mods)
|
for (const auto& modPath : m_mods)
|
||||||
{
|
{
|
||||||
if (boost::filesystem::exists(modPath))
|
if (std::filesystem::exists(modPath))
|
||||||
{
|
{
|
||||||
GetLogger()->Info(" * %s\n", modPath.c_str());
|
GetLogger()->Info(" * %s\n", modPath.c_str());
|
||||||
mods.push_back(modPath);
|
mods.push_back(modPath);
|
||||||
|
@ -184,18 +173,11 @@ std::vector<std::string> CPathManager::FindModsInDir(const std::string &dir) con
|
||||||
std::vector<std::string> ret;
|
std::vector<std::string> ret;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
#if PLATFORM_WINDOWS
|
std::filesystem::directory_iterator iterator(std::filesystem::u8path(dir));
|
||||||
boost::filesystem::directory_iterator iterator(CSystemUtilsWindows::UTF8_Decode(dir));
|
|
||||||
#else
|
for(; iterator != std::filesystem::directory_iterator(); ++iterator)
|
||||||
boost::filesystem::directory_iterator iterator(dir);
|
|
||||||
#endif
|
|
||||||
for(; iterator != boost::filesystem::directory_iterator(); ++iterator)
|
|
||||||
{
|
{
|
||||||
#if PLATFORM_WINDOWS
|
ret.push_back(iterator->path().u8string());
|
||||||
ret.push_back(CSystemUtilsWindows::UTF8_Encode(iterator->path().wstring()));
|
|
||||||
#else
|
|
||||||
ret.push_back(iterator->path().string());
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (std::exception &e)
|
catch (std::exception &e)
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
#include <CoreFoundation/CFBundle.h>
|
#include <CoreFoundation/CFBundle.h>
|
||||||
#include <CoreServices/CoreServices.h>
|
#include <CoreServices/CoreServices.h>
|
||||||
|
|
||||||
#include <boost/filesystem.hpp>
|
#include <filesystem>
|
||||||
|
|
||||||
inline std::string CFStringRefToStdString(CFStringRef str) {
|
inline std::string CFStringRefToStdString(CFStringRef str) {
|
||||||
|
|
||||||
|
@ -78,7 +78,7 @@ void CSystemUtilsMacOSX::Init()
|
||||||
m_ASPath.append("/colobot/");
|
m_ASPath.append("/colobot/");
|
||||||
|
|
||||||
// Make sure the directory exists
|
// Make sure the directory exists
|
||||||
boost::filesystem::create_directories(m_ASPath.c_str());
|
std::filesystem::create_directories(m_ASPath.c_str());
|
||||||
|
|
||||||
// Get the Resources bundle URL
|
// Get the Resources bundle URL
|
||||||
CFBundleRef mainBundle = CFBundleGetMainBundle();
|
CFBundleRef mainBundle = CFBundleGetMainBundle();
|
||||||
|
|
|
@ -21,9 +21,9 @@
|
||||||
|
|
||||||
#include "common/logger.h"
|
#include "common/logger.h"
|
||||||
|
|
||||||
#include <boost/filesystem.hpp>
|
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
|
|
||||||
|
#include <filesystem>
|
||||||
|
|
||||||
void CSystemUtilsWindows::Init()
|
void CSystemUtilsWindows::Init()
|
||||||
{
|
{
|
||||||
|
@ -132,7 +132,7 @@ std::string CSystemUtilsWindows::GetEnvVar(const std::string& name)
|
||||||
|
|
||||||
bool CSystemUtilsWindows::OpenPath(const std::string& path)
|
bool CSystemUtilsWindows::OpenPath(const std::string& path)
|
||||||
{
|
{
|
||||||
int result = system(("start explorer \"" + boost::filesystem::path(path).make_preferred().string() + "\"").c_str());
|
int result = system(("start explorer \"" + std::filesystem::u8path(path).make_preferred().string() + "\"").c_str());
|
||||||
if (result != 0)
|
if (result != 0)
|
||||||
{
|
{
|
||||||
GetLogger()->Error("Failed to open path: %s, error code: %i\n", path.c_str(), result);
|
GetLogger()->Error("Failed to open path: %s, error code: %i\n", path.c_str(), result);
|
||||||
|
|
Loading…
Reference in New Issue