summaryrefslogtreecommitdiff
path: root/uisimulator
diff options
context:
space:
mode:
Diffstat (limited to 'uisimulator')
-rw-r--r--uisimulator/x11/file.h2
-rw-r--r--uisimulator/x11/io.c19
2 files changed, 19 insertions, 2 deletions
diff --git a/uisimulator/x11/file.h b/uisimulator/x11/file.h
index 134019148c..63ccfe108c 100644
--- a/uisimulator/x11/file.h
+++ b/uisimulator/x11/file.h
@@ -23,10 +23,12 @@
23int x11_open(char *name, int opts); 23int x11_open(char *name, int opts);
24int x11_creat(char *name, int mode); 24int x11_creat(char *name, int mode);
25int x11_remove(char *name); 25int x11_remove(char *name);
26int x11_rename(char *oldpath, char *newpath);
26 27
27#define open(x,y) x11_open(x,y) 28#define open(x,y) x11_open(x,y)
28#define creat(x,y) x11_open(x,y) 29#define creat(x,y) x11_open(x,y)
29#define remove(x) x11_remove(x) 30#define remove(x) x11_remove(x)
31#define rename(x,y) x11_rename(x,y)
30 32
31#include "../../firmware/common/file.h" 33#include "../../firmware/common/file.h"
32 34
diff --git a/uisimulator/x11/io.c b/uisimulator/x11/io.c
index 5890254b79..6a19dd07b1 100644
--- a/uisimulator/x11/io.c
+++ b/uisimulator/x11/io.c
@@ -116,7 +116,7 @@ int x11_creat(char *name, int mode)
116 if(name[0] == '/') { 116 if(name[0] == '/') {
117 sprintf(buffer, "%s%s", SIMULATOR_ARCHOS_ROOT, name); 117 sprintf(buffer, "%s%s", SIMULATOR_ARCHOS_ROOT, name);
118 118
119 debugf("We open the real file '%s'\n", buffer); 119 debugf("We create the real file '%s'\n", buffer);
120 return creat(buffer, mode); 120 return creat(buffer, mode);
121 } 121 }
122 return creat(name, mode); 122 return creat(name, mode);
@@ -129,12 +129,27 @@ int x11_remove(char *name)
129 if(name[0] == '/') { 129 if(name[0] == '/') {
130 sprintf(buffer, "%s%s", SIMULATOR_ARCHOS_ROOT, name); 130 sprintf(buffer, "%s%s", SIMULATOR_ARCHOS_ROOT, name);
131 131
132 debugf("We open the real file '%s'\n", buffer); 132 debugf("We remove the real file '%s'\n", buffer);
133 return remove(buffer); 133 return remove(buffer);
134 } 134 }
135 return remove(name); 135 return remove(name);
136} 136}
137 137
138int x11_rename(char *oldpath, char* newpath)
139{
140 char buffer1[256];
141 char buffer2[256];
142
143 if(oldpath[0] == '/') {
144 sprintf(buffer1, "%s%s", SIMULATOR_ARCHOS_ROOT, oldpath);
145 sprintf(buffer2, "%s%s", SIMULATOR_ARCHOS_ROOT, newpath);
146
147 debugf("We rename the real file '%s' to '%s'\n", buffer1, buffer2);
148 return rename(buffer1, buffer2);
149 }
150 return -1;
151}
152
138void fat_size(unsigned int* size, unsigned int* free) 153void fat_size(unsigned int* size, unsigned int* free)
139{ 154{
140 struct statfs fs; 155 struct statfs fs;