MCPcopy Create free account
hub / github.com/DFHack/dfhack / as_string

Function as_string

library/include/modules/Filesystem.h:78–87  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

76 int depth = 10, bool include_prefix = true) noexcept;
77 DFHACK_EXPORT std::filesystem::path canonicalize(std::filesystem::path p) noexcept;
78 inline std::string as_string(const std::filesystem::path path) noexcept
79 {
80 // this just mashes the utf-8 into a std::string without any conversion
81 // this is largely because we use utf-8 everywhere internally as much as we can
82 // but we should ultimately convert to using u8strings for strings that are utf-8
83 // and use a different string type for strings encoded in cp437 or in the locale codepage
84 std::u8string pstr = path.generic_u8string();
85 return std::string((char*)pstr.c_str());
86
87 }
88 DFHACK_EXPORT std::filesystem::path getInstallDir() noexcept;
89 DFHACK_EXPORT std::filesystem::path getBaseDir() noexcept;
90

Callers 5

lua_readMethod · 0.85
filesystem_listdirFunction · 0.85
internal_findScriptFunction · 0.85
list_libraryFunction · 0.85

Calls 1

c_strMethod · 0.80

Tested by

no test coverage detected