diff --git a/Source/dvlnet/zerotier_native.cpp b/Source/dvlnet/zerotier_native.cpp index 921b13a78..479d8f2d0 100644 --- a/Source/dvlnet/zerotier_native.cpp +++ b/Source/dvlnet/zerotier_native.cpp @@ -95,7 +95,8 @@ std::string ToZTCompliantPath(std::string_view configPath) } std::string symlinkPath = StrCat(alternateConfigPath, "\\", alternateFolderName); - bool symlinkExists = std::filesystem::exists(std::filesystem::u8path(symlinkPath), err); + bool symlinkExists = std::filesystem::exists( + std::u8string_view(reinterpret_cast(symlinkPath.data()), symlinkPath.size()), err); if (err) { LogVerbose("Failed to determine if symlink for ZT-compliant config path exists"); return std::string(configPath); @@ -103,8 +104,8 @@ std::string ToZTCompliantPath(std::string_view configPath) if (!symlinkExists) { std::filesystem::create_directory_symlink( - std::filesystem::u8path(configPath), - std::filesystem::u8path(symlinkPath), + std::u8string_view(reinterpret_cast(configPath.data()), configPath.size()), + std::u8string_view(reinterpret_cast(symlinkPath.data()), symlinkPath.size()), err); if (err) { diff --git a/Source/utils/file_util.cpp b/Source/utils/file_util.cpp index 5796fd25b..7dd7de82c 100644 --- a/Source/utils/file_util.cpp +++ b/Source/utils/file_util.cpp @@ -106,7 +106,7 @@ bool FileExists(const char *path) return ::access(path, F_OK) == 0; #elif defined(DVL_HAS_FILESYSTEM) std::error_code ec; - return std::filesystem::exists(std::filesystem::u8path(path), ec); + return std::filesystem::exists(reinterpret_cast(path), ec); #else SDL_RWops *file = SDL_RWFromFile(path, "r+b"); if (file == nullptr) @@ -154,7 +154,7 @@ bool DirectoryExists(const char *path) return attr != INVALID_FILE_ATTRIBUTES && (attr & FILE_ATTRIBUTE_DIRECTORY) != 0; #elif defined(DVL_HAS_FILESYSTEM) std::error_code error; - return std::filesystem::is_directory(std::filesystem::u8path(path), error); + return std::filesystem::is_directory(reinterpret_cast(path), error); #elif (_POSIX_C_SOURCE >= 200112L || defined(_BSD_SOURCE) || defined(__APPLE__)) && !defined(__ANDROID__) struct ::stat statResult; return ::stat(path, &statResult) == 0 && S_ISDIR(statResult.st_mode); @@ -233,7 +233,7 @@ bool CreateDir(const char *path) { #ifdef DVL_HAS_FILESYSTEM std::error_code error; - std::filesystem::create_directory(std::filesystem::u8path(path), error); + std::filesystem::create_directory(reinterpret_cast(path), error); if (error) { LogError("failed to create directory {}: {}", path, error.message()); return false; @@ -274,7 +274,7 @@ void RecursivelyCreateDir(const char *path) { #ifdef DVL_HAS_FILESYSTEM std::error_code error; - std::filesystem::create_directories(std::filesystem::u8path(path), error); + std::filesystem::create_directories(reinterpret_cast(path), error); if (error) { LogError("failed to create directory {}: {}", path, error.message()); } @@ -373,7 +373,7 @@ void RenameFile(const char *from, const char *to) #endif // _WIN32 #elif defined(DVL_HAS_FILESYSTEM) std::error_code ec; - std::filesystem::rename(std::filesystem::u8path(from), std::filesystem::u8path(to), ec); + std::filesystem::rename(reinterpret_cast(from), reinterpret_cast(to), ec); #else ::rename(from, to); #endif @@ -401,7 +401,7 @@ void CopyFileOverwrite(const char *from, const char *to) ::copyfile(from, to, nullptr, COPYFILE_ALL); #elif defined(DVL_HAS_FILESYSTEM) std::error_code error; - std::filesystem::copy_file(std::filesystem::u8path(from), std::filesystem::u8path(to), std::filesystem::copy_options::overwrite_existing, error); + std::filesystem::copy_file(reinterpret_cast(from), reinterpret_cast(to), std::filesystem::copy_options::overwrite_existing, error); if (error) { LogError("Failed to copy {} to {}: {}", from, to, error.message()); }