mirror of
https://github.com/devkitPro/wut.git
synced 2026-04-10 11:15:32 -05:00
- Improved error codes for unlink and rmdir regarding non-empty directories. - Return ENOENT on empty strings since it softlocks the Wii U. Since the devoptab relies on the cwd it's pretty easy to run into with stuff like recursive path creation for example. - Clean up open_r mode_t->string conversion - Improved FSStat->mode_t conversion - Add FSOpenFileEx and flags
34 lines
841 B
C
34 lines
841 B
C
#include "devoptab_fs.h"
|
|
|
|
int
|
|
__wut_fs_dirnext(struct _reent *r,
|
|
DIR_ITER *dirState,
|
|
char *filename,
|
|
struct stat *filestat)
|
|
{
|
|
FSStatus status;
|
|
FSCmdBlock cmd;
|
|
__wut_fs_dir_t *dir;
|
|
|
|
if (!dirState || !filename || !filestat) {
|
|
r->_errno = EINVAL;
|
|
return -1;
|
|
}
|
|
|
|
FSInitCmdBlock(&cmd);
|
|
dir = (__wut_fs_dir_t *)(dirState->dirStruct);
|
|
memset(&dir->entry_data, 0, sizeof(dir->entry_data));
|
|
status = FSReadDir(__wut_devoptab_fs_client, &cmd, dir->fd, &dir->entry_data,
|
|
FS_ERROR_FLAG_ALL);
|
|
if (status < 0) {
|
|
r->_errno = __wut_fs_translate_error(status);
|
|
return -1;
|
|
}
|
|
|
|
__wut_fs_translate_stat(&dir->entry_data.info, filestat);
|
|
|
|
memset(filename, 0, NAME_MAX);
|
|
strcpy(filename, dir->entry_data.name);
|
|
return 0;
|
|
}
|