MCPcopy Create free account
hub / github.com/MayaPosch/NymphCast / IsDir

Method IsDir

src/server/angelscript/add_on/scriptfile/scriptfilesystem.cpp:291–319  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

289}
290
291bool CScriptFileSystem::IsDir(const string &path) const
292{
293 string search;
294 if( path.find(":") != string::npos || path.find("/") == 0 || path.find("\\") == 0 )
295 search = path;
296 else
297 search = currentPath + "/" + path;
298
299#if defined(_WIN32)
300 // Windows uses UTF16 so it is necessary to convert the string
301 wchar_t bufUTF16[10000];
302 MultiByteToWideChar(CP_UTF8, 0, search.c_str(), -1, bufUTF16, 10000);
303
304 // Check if the path exists and is a directory
305 DWORD attrib = GetFileAttributesW(bufUTF16);
306 if( attrib == INVALID_FILE_ATTRIBUTES ||
307 !(attrib & FILE_ATTRIBUTE_DIRECTORY) )
308 return false;
309#else
310 // Check if the path exists and is a directory
311 struct stat st;
312 if( stat(search.c_str(), &st) == -1 )
313 return false;
314 if( (st.st_mode & S_IFDIR) == 0 )
315 return false;
316#endif
317
318 return true;
319}
320
321bool CScriptFileSystem::IsLink(const string &path) const
322{

Callers

nothing calls this directly

Calls 3

statClass · 0.85
c_strMethod · 0.80
findMethod · 0.45

Tested by

no test coverage detected