mbed library sources

Fork of mbed-src by mbed official

Revision:
284:859ffaa7c331
Parent:
269:0e58554f11d5
Child:
285:31249416b6f9
--- a/common/retarget.cpp	Wed Aug 13 09:00:06 2014 +0100
+++ b/common/retarget.cpp	Wed Aug 13 10:30:07 2014 +0100
@@ -323,7 +323,15 @@
 }
 
 extern "C" int rename(const char *oldname, const char *newname) {
-    return -1;
+    FilePath fpOld(oldname);
+    FilePath fpNew(newname);
+    FileSystemLike *fsOld = fpOld.fileSystem();
+    FileSystemLike *fsNew = fpNew.fileSystem();
+
+    /* rename only if both files are on the same FS */
+    if (fsOld != fsNew || fsOld == NULL) return -1;
+
+    return fsOld->rename(fpOld.fileName(), fpNew.fileName());
 }
 
 extern "C" char *tmpnam(char *s) {