MCPcopy Create free account
hub / github.com/BYVoid/OpenCC / IsRegularFileUtf8

Function IsRegularFileUtf8

src/ResourceProvider.cpp:69–82  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

67}
68
69bool IsRegularFileUtf8(const std::string& path) {
70#if defined(_WIN32) || defined(_WIN64)
71 const DWORD attributes =
72 GetFileAttributesW(internal::WideFromUtf8(path).c_str());
73 return attributes != INVALID_FILE_ATTRIBUTES &&
74 (attributes & FILE_ATTRIBUTE_DIRECTORY) == 0;
75#else
76 struct stat info;
77 if (stat(path.c_str(), &info) != 0) {
78 return false;
79 }
80 return (info.st_mode & S_IFMT) == S_IFREG;
81#endif
82}
83
84std::string JoinPath(const std::string& root, const std::string& resource) {
85 if (root.empty()) {

Callers 1

ResolveMethod · 0.85

Calls 2

WideFromUtf8Function · 0.70
statClass · 0.70

Tested by

no test coverage detected