MCPcopy Create free account
hub / github.com/GarageGames/Torque2D / hasSubDirectory

Method hasSubDirectory

engine/source/platformEmscripten/EmscriptenFileio.cpp:1009–1050  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1007//-----------------------------------------------------------------------------
1008
1009bool Platform::hasSubDirectory(const char *pPath)
1010{
1011 if (!pPath)
1012 return false;
1013 ResourceManager->initExcludedDirectories();
1014
1015 struct dirent *d;
1016 DIR *dip;
1017 dip = opendir(pPath);
1018 if (dip == NULL)
1019 return false;
1020
1021 while (d = readdir(dip))
1022 {
1023 bool isDir = false;
1024 if (d->d_type == DT_UNKNOWN)
1025 {
1026 char child [1024];
1027 if ((pPath[dStrlen(pPath) - 1] == '/'))
1028 dSprintf(child, 1024, "%s%s", pPath, d->d_name);
1029 else
1030 dSprintf(child, 1024, "%s/%s", pPath, d->d_name);
1031 isDir = Platform::isDirectory (child);
1032 }
1033 else if (d->d_type & DT_DIR)
1034 isDir = true;
1035 if( isDir )
1036 {
1037 // Skip the . and .. directories
1038 if (dStrcmp(d->d_name, ".") == 0 ||dStrcmp(d->d_name, "..") == 0)
1039 continue;
1040 if (Platform::isExcludedDirectory(d->d_name))
1041 continue;
1042 Platform::clearExcludedDirectories();
1043 closedir(dip);
1044 return true;
1045 }
1046 }
1047 closedir(dip);
1048 Platform::clearExcludedDirectories();
1049 return false;
1050}
1051
1052static bool recurseDumpDirectories(const char *basePath, const char *subPath, Vector<StringTableEntry> &directoryVector, S32 currentDepth, S32 recurseDepth, bool noBasePath)
1053{

Callers

nothing calls this directly

Calls 4

dStrlenFunction · 0.70
dSprintfFunction · 0.70
dStrcmpFunction · 0.70

Tested by

no test coverage detected