summaryrefslogtreecommitdiff
path: root/firmware/common
diff options
context:
space:
mode:
authorBjörn Stenberg <bjorn@haxx.se>2003-01-27 09:32:17 +0000
committerBjörn Stenberg <bjorn@haxx.se>2003-01-27 09:32:17 +0000
commit184fd554115beb52bb4037ddcd36d8db26d5938d (patch)
treeb653181904020b1875c67d07359770de9590d53d /firmware/common
parentb6a4f2fb2c9cf53cd4e59fd901974a81100f6711 (diff)
downloadrockbox-184fd554115beb52bb4037ddcd36d8db26d5938d.zip
rockbox-184fd554115beb52bb4037ddcd36d8db26d5938d.tar.gz
rockbox-184fd554115beb52bb4037ddcd36d8db26d5938d.tar.bz2
rockbox-184fd554115beb52bb4037ddcd36d8db26d5938d.tar.xz
Directories can now be renamed too.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@3167 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/common')
-rw-r--r--firmware/common/file.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/firmware/common/file.c b/firmware/common/file.c
index 4477ed1..dfbebe1 100644
--- a/firmware/common/file.c
+++ b/firmware/common/file.c
@@ -40,6 +40,7 @@ struct filedesc {
int cacheoffset;
int fileoffset;
int size;
+ int attr;
struct fat_file fatfile;
bool busy;
bool write;
@@ -122,6 +123,7 @@ int open(const char* pathname, int flags)
&(file->fatfile),
&(dir->fatdir));
file->size = entry->size;
+ file->attr = entry->attribute;
break;
}
}
@@ -139,6 +141,7 @@ int open(const char* pathname, int flags)
return -5;
}
file->size = 0;
+ file->attr = 0;
}
else {
DEBUGF("Couldn't find %s in %s\n",name,pathname);
@@ -190,7 +193,7 @@ int close(int fd)
}
/* tie up all loose ends */
- if (fat_closewrite(&(file->fatfile), file->size) < 0)
+ if (fat_closewrite(&(file->fatfile), file->size, file->attr) < 0)
return -3;
}
file->busy = false;
@@ -257,7 +260,7 @@ int rename(const char* path, const char* newpath)
nameptr = (char*)newpath;
file = &openfiles[fd];
- rc = fat_rename(&file->fatfile, nameptr, file->size);
+ rc = fat_rename(&file->fatfile, nameptr, file->size, file->attr);
if ( rc < 0 ) {
DEBUGF("Failed renaming file: %d\n", rc);
errno = EIO;