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

Method FileIsExecutable

Source/kwsys/SystemTools.cxx:3077–3092  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3075}
3076
3077bool SystemTools::FileIsExecutable(std::string const& inName)
3078{
3079#ifdef _WIN32
3080 char local_buffer[KWSYS_SYSTEMTOOLS_MAXPATH];
3081 std::string string_buffer;
3082 auto const name = RemoveTrailingSlashes(inName, local_buffer, string_buffer);
3083 auto const attr =
3084 GetFileAttributesW(Encoding::ToWindowsExtendedPath(name).c_str());
3085
3086 // On Windows any file that exists and is not a directory is considered
3087 // readable and therefore also executable:
3088 return attr != INVALID_FILE_ATTRIBUTES && !(attr & FILE_ATTRIBUTE_DIRECTORY);
3089#else
3090 return !FileIsDirectory(inName) && TestFileAccess(inName, TEST_FILE_EXECUTE);
3091#endif
3092}
3093
3094#if defined(_WIN32)
3095bool SystemTools::FileIsSymlinkWithAttr(std::wstring const& path,

Callers

nothing calls this directly

Calls 2

RemoveTrailingSlashesFunction · 0.85
c_strMethod · 0.80

Tested by

no test coverage detected