fs/Features: add macro FS_CHARSET_ALWAYS_UTF8
This commit is contained in:
parent
162845cc6d
commit
7a98a784b2
@ -32,24 +32,24 @@ AllocatedPath::~AllocatedPath() noexcept = default;
|
||||
AllocatedPath
|
||||
AllocatedPath::FromUTF8(const char *path_utf8) noexcept
|
||||
{
|
||||
#if defined(HAVE_FS_CHARSET) || defined(_WIN32)
|
||||
#ifdef FS_CHARSET_ALWAYS_UTF8
|
||||
return FromFS(path_utf8);
|
||||
#else
|
||||
try {
|
||||
return AllocatedPath(::PathFromUTF8(path_utf8));
|
||||
} catch (...) {
|
||||
return nullptr;
|
||||
}
|
||||
#else
|
||||
return FromFS(path_utf8);
|
||||
#endif
|
||||
}
|
||||
|
||||
AllocatedPath
|
||||
AllocatedPath::FromUTF8Throw(const char *path_utf8)
|
||||
{
|
||||
#if defined(HAVE_FS_CHARSET) || defined(_WIN32)
|
||||
return AllocatedPath(::PathFromUTF8(path_utf8));
|
||||
#else
|
||||
#ifdef FS_CHARSET_ALWAYS_UTF8
|
||||
return FromFS(path_utf8);
|
||||
#else
|
||||
return AllocatedPath(::PathFromUTF8(path_utf8));
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -26,4 +26,11 @@
|
||||
#define HAVE_FS_CHARSET
|
||||
#endif
|
||||
|
||||
#if !defined(HAVE_FS_CHARSET) && !defined(_WIN32)
|
||||
/**
|
||||
* Is the filesystem character set hard-coded to UTF-8?
|
||||
*/
|
||||
#define FS_CHARSET_ALWAYS_UTF8
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user