mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-12-10 13:45:10 -05:00
Added rename() to simulator
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@3090 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
541fa6ac3a
commit
7d80ba0131
2 changed files with 19 additions and 2 deletions
|
|
@ -23,10 +23,12 @@
|
||||||
int x11_open(char *name, int opts);
|
int x11_open(char *name, int opts);
|
||||||
int x11_creat(char *name, int mode);
|
int x11_creat(char *name, int mode);
|
||||||
int x11_remove(char *name);
|
int x11_remove(char *name);
|
||||||
|
int x11_rename(char *oldpath, char *newpath);
|
||||||
|
|
||||||
#define open(x,y) x11_open(x,y)
|
#define open(x,y) x11_open(x,y)
|
||||||
#define creat(x,y) x11_open(x,y)
|
#define creat(x,y) x11_open(x,y)
|
||||||
#define remove(x) x11_remove(x)
|
#define remove(x) x11_remove(x)
|
||||||
|
#define rename(x,y) x11_rename(x,y)
|
||||||
|
|
||||||
#include "../../firmware/common/file.h"
|
#include "../../firmware/common/file.h"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -116,7 +116,7 @@ int x11_creat(char *name, int mode)
|
||||||
if(name[0] == '/') {
|
if(name[0] == '/') {
|
||||||
sprintf(buffer, "%s%s", SIMULATOR_ARCHOS_ROOT, name);
|
sprintf(buffer, "%s%s", SIMULATOR_ARCHOS_ROOT, name);
|
||||||
|
|
||||||
debugf("We open the real file '%s'\n", buffer);
|
debugf("We create the real file '%s'\n", buffer);
|
||||||
return creat(buffer, mode);
|
return creat(buffer, mode);
|
||||||
}
|
}
|
||||||
return creat(name, mode);
|
return creat(name, mode);
|
||||||
|
|
@ -129,12 +129,27 @@ int x11_remove(char *name)
|
||||||
if(name[0] == '/') {
|
if(name[0] == '/') {
|
||||||
sprintf(buffer, "%s%s", SIMULATOR_ARCHOS_ROOT, name);
|
sprintf(buffer, "%s%s", SIMULATOR_ARCHOS_ROOT, name);
|
||||||
|
|
||||||
debugf("We open the real file '%s'\n", buffer);
|
debugf("We remove the real file '%s'\n", buffer);
|
||||||
return remove(buffer);
|
return remove(buffer);
|
||||||
}
|
}
|
||||||
return remove(name);
|
return remove(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int x11_rename(char *oldpath, char* newpath)
|
||||||
|
{
|
||||||
|
char buffer1[256];
|
||||||
|
char buffer2[256];
|
||||||
|
|
||||||
|
if(oldpath[0] == '/') {
|
||||||
|
sprintf(buffer1, "%s%s", SIMULATOR_ARCHOS_ROOT, oldpath);
|
||||||
|
sprintf(buffer2, "%s%s", SIMULATOR_ARCHOS_ROOT, newpath);
|
||||||
|
|
||||||
|
debugf("We rename the real file '%s' to '%s'\n", buffer1, buffer2);
|
||||||
|
return rename(buffer1, buffer2);
|
||||||
|
}
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
void fat_size(unsigned int* size, unsigned int* free)
|
void fat_size(unsigned int* size, unsigned int* free)
|
||||||
{
|
{
|
||||||
struct statfs fs;
|
struct statfs fs;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue