Base: Remove Boost-based filesystem and switch to standard <filesystem>
This commit is contained in:
@@ -208,18 +208,18 @@ std::string FileInfo::getTempFileName(const char* FileName, const char* Path)
|
||||
#endif
|
||||
}
|
||||
|
||||
boost::filesystem::path FileInfo::stringToPath(const std::string& str)
|
||||
std::filesystem::path FileInfo::stringToPath(const std::string& str)
|
||||
{
|
||||
#if defined(FC_OS_WIN32)
|
||||
std::wstring_convert<std::codecvt_utf8_utf16<wchar_t>> converter;
|
||||
boost::filesystem::path path(converter.from_bytes(str));
|
||||
std::filesystem::path path(converter.from_bytes(str));
|
||||
#else
|
||||
boost::filesystem::path path(str);
|
||||
std::filesystem::path path(str);
|
||||
#endif
|
||||
return path;
|
||||
}
|
||||
|
||||
std::string FileInfo::pathToString(const boost::filesystem::path& path)
|
||||
std::string FileInfo::pathToString(const std::filesystem::path& path)
|
||||
{
|
||||
#if defined(FC_OS_WIN32)
|
||||
std::wstring_convert<std::codecvt_utf8_utf16<wchar_t>> converter;
|
||||
@@ -583,14 +583,14 @@ bool FileInfo::createDirectory() const
|
||||
bool FileInfo::createDirectories() const
|
||||
{
|
||||
try {
|
||||
boost::filesystem::path path(stringToPath(FileName));
|
||||
if (boost::filesystem::exists(path)) {
|
||||
std::filesystem::path path(stringToPath(FileName));
|
||||
if (std::filesystem::exists(path)) {
|
||||
return true;
|
||||
}
|
||||
boost::filesystem::create_directories(path);
|
||||
std::filesystem::create_directories(path);
|
||||
return true;
|
||||
}
|
||||
catch (const boost::filesystem::filesystem_error&) {
|
||||
catch (const std::filesystem::filesystem_error&) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
#ifndef BASE_FILEINFO_H
|
||||
#define BASE_FILEINFO_H
|
||||
|
||||
#include <boost/filesystem.hpp>
|
||||
#include <filesystem>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <Base/TimeInfo.h>
|
||||
@@ -158,9 +158,9 @@ public:
|
||||
/// Get the path to the dir which is considered to temp files
|
||||
static const std::string& getTempPath();
|
||||
/// Convert from filesystem path to string
|
||||
static std::string pathToString(const boost::filesystem::path& path);
|
||||
static std::string pathToString(const std::filesystem::path& path);
|
||||
/// Convert from string to filesystem path
|
||||
static boost::filesystem::path stringToPath(const std::string& str);
|
||||
static std::filesystem::path stringToPath(const std::string& str);
|
||||
//@}
|
||||
|
||||
private:
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
#include <algorithm>
|
||||
#include <array>
|
||||
#include <cmath>
|
||||
#include <cstring>
|
||||
#include <limits>
|
||||
#include <sstream>
|
||||
#include <utility>
|
||||
|
||||
Reference in New Issue
Block a user