Build system almost done

This commit is contained in:
2025-06-02 19:56:18 +03:00
parent ade32c24a6
commit 3beb7aad3b
16 changed files with 191 additions and 77 deletions

View File

@@ -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 )