Build system almost done
This commit is contained in:
@@ -60,7 +60,35 @@ PLATFORM_INTERFACE void Plat_ListDirRecursive(const char* szPath, ListDirCallbac
|
||||
}
|
||||
PLATFORM_INTERFACE void Plat_ListDir(const char* szPath, ListDirCallbackFn file, ListDirCallbackFn dir)
|
||||
{
|
||||
struct dirent *entry;
|
||||
DIR *dp = opendir(szPath);
|
||||
|
||||
if (!dp) {
|
||||
return;
|
||||
}
|
||||
|
||||
while ((entry = readdir(dp)) != NULL) {
|
||||
char full_path[1024];
|
||||
if (strcmp(entry->d_name, ".") == 0 || strcmp(entry->d_name, "..") == 0)
|
||||
continue;
|
||||
|
||||
snprintf(full_path, sizeof(full_path), "%s/%s", szPath, entry->d_name);
|
||||
|
||||
struct stat statbuf;
|
||||
if (stat(full_path, &statbuf) == -1) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (S_ISDIR(statbuf.st_mode)) {
|
||||
if (dir)
|
||||
dir(full_path);
|
||||
} else {
|
||||
if (file)
|
||||
file(full_path);
|
||||
}
|
||||
}
|
||||
|
||||
closedir(dp);
|
||||
}
|
||||
|
||||
PLATFORM_INTERFACE char *Plat_GetExtension( const char *szPath )
|
||||
|
||||
Reference in New Issue
Block a user