mirror of
https://github.com/ggerganov/whisper.cpp.git
synced 2025-05-18 23:20:44 +02:00
ggml-backend : make path_str compatible with C++20 (llama/12269)
This commit is contained in:
parent
9fb9025a40
commit
521d72d76e
@ -76,7 +76,14 @@ namespace fs = std::filesystem;
|
|||||||
static std::string path_str(const fs::path & path) {
|
static std::string path_str(const fs::path & path) {
|
||||||
std::string u8path;
|
std::string u8path;
|
||||||
try {
|
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();
|
u8path = path.u8string();
|
||||||
|
#endif
|
||||||
} catch (...) {
|
} catch (...) {
|
||||||
}
|
}
|
||||||
return u8path;
|
return u8path;
|
||||||
|
Loading…
Reference in New Issue
Block a user