Also use _stat() on Windows to be more UTF8 friendly #2978
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR tries to fix #2977.
The advantage of using
_stat()
function overGetFileAttributesA()
API is that:SPDLOG_WCHAR_FILENAMES
is not defined:-- If
setlocale(LC_ALL, ".UTF8")
is called before, then filename will be treated as UTF8 string, and this is the main use case for supporting UTF8 filenames with std::string under Windows.-- If
setlocale(LC_ALL, ".UTF8")
is not called before, then filename will be treated with the current code page (CP_ACP), just like the old behavior.SPDLOG_WCHAR_FILENAMES
is defined, the behavior is the same as ifGetFileAttributesW()
was used.