7#ifndef MYGUI_FILE_SYSTEM_UTILITY_H_
8#define MYGUI_FILE_SYSTEM_UTILITY_H_
19 inline std::filesystem::path
toPath(std::string_view text)
24 return std::filesystem::u8path(text.data(), text.data() + text.size());
28 inline std::filesystem::path
toPath(
const char* text)
30 return toPath(std::string_view(text));
34 inline std::filesystem::path
toPath(
const std::string& text)
36 return toPath(std::string_view(text));
40 inline std::filesystem::path
toPath(
const UString& text)
42 return toPath(text.asUTF8());
46 inline std::string
toUtf8(
const std::filesystem::path& path)
48 const auto text = path.u8string();
49 return {text.begin(), text.end()};
std::string toUtf8(const std::filesystem::path &path)
Convert a filesystem path to UTF-8 bytes.
std::filesystem::path toPath(std::string_view text)
Convert UTF-8 bytes to a native filesystem path.