summaryrefslogtreecommitdiff
path: root/firmware/drivers
diff options
context:
space:
mode:
authorLinus Nielsen Feltzing <linus@haxx.se>2004-04-16 08:58:29 +0000
committerLinus Nielsen Feltzing <linus@haxx.se>2004-04-16 08:58:29 +0000
commitbc9397d1fa1e05a09f24f5999fa2e85a23916ab9 (patch)
tree5cd8d1f4abc1f40627662c61cdd833d3cc9e768b /firmware/drivers
parentb8beff39e92ebe8c417ef6b9d1a7d467bf84826a (diff)
downloadrockbox-bc9397d1fa1e05a09f24f5999fa2e85a23916ab9.zip
rockbox-bc9397d1fa1e05a09f24f5999fa2e85a23916ab9.tar.gz
rockbox-bc9397d1fa1e05a09f24f5999fa2e85a23916ab9.tar.bz2
rockbox-bc9397d1fa1e05a09f24f5999fa2e85a23916ab9.tar.xz
New function: rmdir(). Also some changes in the fat code, to track the parent directory in opendir(), to be able to delete directories
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@4509 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/drivers')
-rw-r--r--firmware/drivers/fat.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/firmware/drivers/fat.c b/firmware/drivers/fat.c
index 0c8997d..bb10c5f 100644
--- a/firmware/drivers/fat.c
+++ b/firmware/drivers/fat.c
@@ -1543,6 +1543,10 @@ int fat_remove(struct fat_file* file)
file->firstcluster = 0;
file->dircluster = 0;
+ rc = flush_fat();
+ if (rc < 0)
+ return rc * 10 - 2;
+
return 0;
}
@@ -1561,7 +1565,7 @@ int fat_rename(struct fat_file* file,
}
/* create a temporary file handle */
- rc = fat_opendir(&dir, file->dircluster);
+ rc = fat_opendir(&dir, file->dircluster, NULL);
if (rc < 0)
return rc * 10 - 2;
@@ -1796,14 +1800,15 @@ int fat_seek(struct fat_file *file, unsigned int seeksector )
return 0;
}
-int fat_opendir(struct fat_dir *dir, unsigned int startcluster)
+int fat_opendir(struct fat_dir *dir, unsigned int startcluster,
+ struct fat_dir *parent_dir)
{
int rc;
if (startcluster == 0)
startcluster = sec2cluster(fat_bpb.rootdirsector);
- rc = fat_open(startcluster, &dir->file, NULL);
+ rc = fat_open(startcluster, &dir->file, parent_dir);
if(rc)
{
DEBUGF( "fat_opendir() - Couldn't open dir"