MCPcopy Create free account
hub / github.com/Kitware/CMake / FileIsDirectory

Method FileIsDirectory

Source/kwsys/SystemTools.cxx:3054–3075  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3052}
3053
3054bool SystemTools::FileIsDirectory(std::string const& inName)
3055{
3056 if (inName.empty()) {
3057 return false;
3058 }
3059
3060 char local_buffer[KWSYS_SYSTEMTOOLS_MAXPATH];
3061 std::string string_buffer;
3062 auto const name = RemoveTrailingSlashes(inName, local_buffer, string_buffer);
3063
3064// Now check the file node type.
3065#if defined(_WIN32)
3066 DWORD attr =
3067 GetFileAttributesW(Encoding::ToWindowsExtendedPath(name).c_str());
3068 return (attr != INVALID_FILE_ATTRIBUTES) &&
3069 (attr & FILE_ATTRIBUTE_DIRECTORY);
3070#else
3071 struct stat fs;
3072
3073 return (stat(name, &fs) == 0) && S_ISDIR(fs.st_mode);
3074#endif
3075}
3076
3077bool SystemTools::FileIsExecutable(std::string const& inName)
3078{

Callers 4

GetNextCandidateMethod · 0.80
CollectTimingDataMethod · 0.80
RecurseDirectoryMethod · 0.80

Calls 4

RemoveTrailingSlashesFunction · 0.85
c_strMethod · 0.80
statClass · 0.70
emptyMethod · 0.45

Tested by 1