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

Function IsReadableFile

plugins/jieba/src/JiebaSegmentationPlugin.cpp:73–82  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

71}
72
73bool IsReadableFile(const std::string& path) {
74#if defined(_WIN32) || defined(_WIN64)
75 const DWORD attributes = GetFileAttributesW(LocalWideFromUtf8(path).c_str());
76 return attributes != INVALID_FILE_ATTRIBUTES &&
77 (attributes & FILE_ATTRIBUTE_DIRECTORY) == 0;
78#else
79 std::ifstream ifs(path.c_str());
80 return ifs.is_open();
81#endif
82}
83
84std::string BaseName(const std::string& path) {
85 const std::string::size_type pos = path.find_last_of("/\\");

Callers 4

ResolveResourcePathFunction · 0.70
ResolveAuxPathFunction · 0.70
CreateJiebaSegmentationFunction · 0.70

Calls 2

LocalWideFromUtf8Function · 0.70
is_openMethod · 0.45

Tested by

no test coverage detected