| 1113 | } |
| 1114 | |
| 1115 | bool Platform::hasSubDirectory(const char *pPath) |
| 1116 | { |
| 1117 | if (!pPath) |
| 1118 | return false; |
| 1119 | |
| 1120 | struct dirent *d; |
| 1121 | DIR *dip; |
| 1122 | dip = opendir(pPath); |
| 1123 | if (dip == NULL) |
| 1124 | return false; |
| 1125 | |
| 1126 | while ((d = readdir(dip))) |
| 1127 | { |
| 1128 | bool isDir = false; |
| 1129 | if (d->d_type == DT_UNKNOWN) |
| 1130 | { |
| 1131 | char child [1024]; |
| 1132 | if ((pPath[dStrlen(pPath) - 1] == '/')) |
| 1133 | dSprintf(child, 1024, "%s%s", pPath, d->d_name); |
| 1134 | else |
| 1135 | dSprintf(child, 1024, "%s/%s", pPath, d->d_name); |
| 1136 | isDir = Platform::isDirectory (child); |
| 1137 | } |
| 1138 | else if (d->d_type & DT_DIR) |
| 1139 | isDir = true; |
| 1140 | if( isDir ) |
| 1141 | { |
| 1142 | // Skip the . and .. directories |
| 1143 | if (dStrcmp(d->d_name, ".") == 0 ||dStrcmp(d->d_name, "..") == 0) |
| 1144 | continue; |
| 1145 | if (Platform::isExcludedDirectory(d->d_name)) |
| 1146 | continue; |
| 1147 | Platform::clearExcludedDirectories(); |
| 1148 | closedir(dip); |
| 1149 | return true; |
| 1150 | } |
| 1151 | } |
| 1152 | closedir(dip); |
| 1153 | Platform::clearExcludedDirectories(); |
| 1154 | return false; |
| 1155 | } |
| 1156 | |
| 1157 | bool Platform::fileDelete(const char * name) |
| 1158 | { |