diff options
author | Nat Goodspeed <nat@lindenlab.com> | 2024-04-03 12:31:43 -0400 |
---|---|---|
committer | Nat Goodspeed <nat@lindenlab.com> | 2024-04-03 12:31:43 -0400 |
commit | e399b02e3306a249cb161f07cac578d3f2617bab (patch) | |
tree | 7cb453600a066cde4b90cec3cc2cf7dd0e62ea84 /indra/llcommon/lua_function.h | |
parent | 3b25bc10febc84f10348715dabc9590458923c0b (diff) |
Introduce fsyspath subclass of std::filesystem::path.
Our std::strings are UTF-8 encoded, so conversion from std::string to
std::filesystem::path must use UTF-8 decoding. The native Windows
std::filesystem::path constructor and assignment operator accepting
std::string use "native narrow encoding," which mangles path strings
containing UTF-8 encoded non-ASCII characters.
fsyspath's std::string constructor and assignment operator explicitly engage
std::filesystem::u8path() to handle encoding. u8path() is deprecated in C++20,
but once we adapt fsyspath's conversion to C++20 conventions, consuming code
need not be modified.
Diffstat (limited to 'indra/llcommon/lua_function.h')
-rw-r--r-- | indra/llcommon/lua_function.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/indra/llcommon/lua_function.h b/indra/llcommon/lua_function.h index 785aadeb0c..ec1e6cdb10 100644 --- a/indra/llcommon/lua_function.h +++ b/indra/llcommon/lua_function.h @@ -16,9 +16,9 @@ #include "luau/lua.h" #include "luau/luaconf.h" #include "luau/lualib.h" +#include "fsyspath.h" #include "stringize.h" #include <exception> // std::uncaught_exceptions() -#include <filesystem> #include <memory> // std::shared_ptr #include <utility> // std::pair @@ -51,7 +51,7 @@ namespace lluau int dostring(lua_State* L, const std::string& desc, const std::string& text); int loadstring(lua_State* L, const std::string& desc, const std::string& text); - std::filesystem::path source_path(lua_State* L); + fsyspath source_path(lua_State* L); } // namespace lluau std::string lua_tostdstring(lua_State* L, int index); |