Base: Remove Boost-based filesystem and switch to standard <filesystem>

This commit is contained in:
tritao
2025-01-19 19:05:06 +00:00
committed by Chris Hennes
parent 5931e3295d
commit f7a0cece08
24 changed files with 144 additions and 110 deletions

View File

@@ -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;
}
}