Fix DirectoryScanner implementation bugs

Fixed several bugs in the DirectoryScanner implementation:

Windows fixes:
- Fixed snprintf call missing buffer size parameter
- Fixed FindFirstFileA to use pattern (with wildcard) instead of path
- Changed sys_GetLastError() to GetLastError()
- Added scanner->first = false after using first result
- Removed TODO comment from cFileName usage (it's the correct field)

Linux fixes:
- Fixed typo: sys_reddir → sys_readdir
- Added missing 'done' field to DirectoryScanner struct
- Initialize scanner->done = false on successful opendir
- Fixed return value when scanner->done (should return 1, not -1)
This commit is contained in:
Claude
2025-11-13 00:45:51 +00:00
parent c903567309
commit 6c2ea4bce9
2 changed files with 11 additions and 7 deletions
+1
View File
@@ -18,6 +18,7 @@ typedef struct {
typedef struct {
DIR *d;
struct dirent *e;
bool done;
} DirectoryScanner;
#endif