diff --git a/src/ox/fs/filesystem/filelocation.hpp b/src/ox/fs/filesystem/filelocation.hpp index 2d512e316..c5f026b01 100644 --- a/src/ox/fs/filesystem/filelocation.hpp +++ b/src/ox/fs/filesystem/filelocation.hpp @@ -65,7 +65,7 @@ class FileAddress { explicit FileAddress(char *path) noexcept; - explicit constexpr FileAddress(const char *path) noexcept; + constexpr FileAddress(ox::StringLiteral path) noexcept; constexpr ~FileAddress() noexcept; @@ -124,8 +124,8 @@ class FileAddress { }; -constexpr FileAddress::FileAddress(const char *path) noexcept { - m_data.constPath = path; +constexpr FileAddress::FileAddress(ox::StringLiteral path) noexcept { + m_data.constPath = path.c_str(); m_type = FileAddressType::ConstPath; } diff --git a/src/ox/std/stringliteral.hpp b/src/ox/std/stringliteral.hpp index f65662215..f777b5afc 100644 --- a/src/ox/std/stringliteral.hpp +++ b/src/ox/std/stringliteral.hpp @@ -41,6 +41,10 @@ class StringLiteral: public detail::BaseStringView { return *this; } + [[nodiscard]] + constexpr const char *c_str() const noexcept { + return data(); + } };