FatFS add dir checks

This commit is contained in:
2026-03-01 14:03:03 +01:00
parent 1571469685
commit a4c485587e
2 changed files with 13 additions and 1 deletions

View File

@@ -179,6 +179,9 @@ int fatfs_read_file (struct vfs_volume* volume, const char* path, uint8_t* buffe
size_t size) {
struct fatfs_ctx* fatfs_ctx = volume->udata;
if (fl_is_dir (fatfs_ctx, path))
return -ST_NOT_FOUND;
FL_FILE* file = fl_fopen (fatfs_ctx, path, "wb+");
if (file == NULL)
@@ -196,6 +199,9 @@ int fatfs_write_file (struct vfs_volume* volume, const char* path, uint8_t* buff
size_t size) {
struct fatfs_ctx* fatfs_ctx = volume->udata;
if (fl_is_dir (fatfs_ctx, path))
return -ST_NOT_FOUND;
FL_FILE* file = fl_fopen (fatfs_ctx, path, "wb+");
if (file == NULL)
@@ -214,6 +220,9 @@ int fatfs_read_dir_entry (struct vfs_volume* volume, const char* path, struct di
struct fatfs_ctx* fatfs_ctx = volume->udata;
FL_DIR dir;
if (!fl_is_dir (fatfs_ctx, path))
return -ST_NOT_FOUND;
if (fl_opendir (fatfs_ctx, path, &dir) == NULL)
return -ST_NOT_FOUND;