]> git.djapps.eu Git - pkg/ggml/sources/llama.cpp/commitdiff
ggml-backend : make path_str compatible with C++20 (#12269)
authorJason C.H <redacted>
Sat, 8 Mar 2025 16:02:39 +0000 (00:02 +0800)
committerGitHub <redacted>
Sat, 8 Mar 2025 16:02:39 +0000 (17:02 +0100)
AUTHORS
ggml/src/ggml-backend-reg.cpp

diff --git a/AUTHORS b/AUTHORS
index 6796b294135954613c8cd06ff98b7a8bbbeabec7..ddcb156388bf05f772240416d33d1e10679a2a8e 100644 (file)
--- a/AUTHORS
+++ b/AUTHORS
@@ -1045,3 +1045,4 @@ zrm <trustiosity.zrm@gmail.com>
 蕭澧邦 <45505768+shou692199@users.noreply.github.com>
 谢乃闻 <sienaiwun@users.noreply.github.com>
 Нияз Гарифзянов <112617865+garrnizon@users.noreply.github.com>
+Jason C.H <ctrysbita@outlook.com>
index d0d68becd89dbb3e64e754f634c71e45190b668d..9bedeae78affb316004f20184e7a4716fd5f412b 100644 (file)
@@ -76,7 +76,14 @@ namespace fs = std::filesystem;
 static std::string path_str(const fs::path & path) {
     std::string u8path;
     try {
+#if defined(__cpp_lib_char8_t)
+        // C++20 and later: u8string() returns std::u8string
+        std::u8string u8str = path.u8string();
+        u8path = std::string(reinterpret_cast<const char*>(u8str.c_str()));
+#else
+        // C++17: u8string() returns std::string
         u8path = path.u8string();
+#endif
     } catch (...) {
     }
     return u8path;