From 184fd554115beb52bb4037ddcd36d8db26d5938d Mon Sep 17 00:00:00 2001 From: Björn Stenberg Date: Mon, 27 Jan 2003 09:32:17 +0000 Subject: Directories can now be renamed too. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@3167 a1c6a512-1295-4272-9138-f99709370657 --- firmware/common/file.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'firmware/common') diff --git a/firmware/common/file.c b/firmware/common/file.c index 4477ed10aa..dfbebe1b90 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; -- cgit v1.2.3