MCPcopy Create free account
hub / github.com/covscript/covscript / can_execute

Function can_execute

sources/system/win32/common.cpp:156–167  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

154 }
155
156 bool can_execute(const std::string &path)
157 {
158 int fd = open(path.c_str(), O_RDONLY);
159 if (fd < 0)
160 return false;
161 char header[2] = {0};
162 int nread = read(fd, reinterpret_cast<void *>(&header), sizeof(header));
163 close(fd);
164 if (nread < 0)
165 return false;
166 return header[0] == 'M' && header[1] == 'Z';
167 }
168 } // namespace file_system
169} // namespace cs_impl
170

Callers 1

is_exeFunction · 0.70

Calls 3

readFunction · 0.85
openFunction · 0.70
closeFunction · 0.70

Tested by

no test coverage detected