File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 7777#include " ggml-zendnn.h"
7878#endif
7979
80- // disable C++17 deprecation warning for std::codecvt_utf8
81- #if defined(__clang__)
82- # pragma clang diagnostic push
83- # pragma clang diagnostic ignored "-Wdeprecated-declarations"
84- #elif defined(__GNUC__)
85- # pragma GCC diagnostic push
86- # pragma GCC diagnostic ignored "-Wdeprecated-declarations"
87- #endif
88-
8980namespace fs = std::filesystem;
9081
9182static std::string path_str (const fs::path & path) {
92- std::string u8path;
9383 try {
9484#if defined(__cpp_lib_char8_t)
9585 // C++20 and later: u8string() returns std::u8string
96- std::u8string u8str = path.u8string ();
97- u8path = std::string (reinterpret_cast <const char *>(u8str.c_str () ));
86+ const std::u8string u8str = path.u8string ();
87+ return std::string (reinterpret_cast <const char *>(u8str.data ()), u8str. size ( ));
9888#else
9989 // C++17: u8string() returns std::string
100- u8path = path.u8string ();
90+ return path.u8string ();
10191#endif
10292 } catch (...) {
93+ return std::string ();
10394 }
104- return u8path;
10595}
10696
107- #if defined(__clang__)
108- # pragma clang diagnostic pop
109- #elif defined(__GNUC__)
110- # pragma GCC diagnostic pop
111- #endif
112-
11397#ifdef _WIN32
11498
11599using dl_handle = std::remove_pointer_t <HMODULE >;
You can’t perform that action at this time.
0 commit comments