mbed library sources modified for open wear

Dependents:   openwear-lifelogger-example

Fork of mbed-src by mbed official

Files at this revision

API Documentation at this revision

Comitter:
mbed_official
Date:
Wed Aug 13 10:30:07 2014 +0100
Parent:
284:bf0f62a62bf4
Child:
286:31249416b6f9
Commit message:
Synchronized with git revision d076c510609d047f287bc16645c1dd644fc66649

Full URL: https://github.com/mbedmicro/mbed/commit/d076c510609d047f287bc16645c1dd644fc66649/

Changed in this revision

common/retarget.cpp Show annotated file Show diff for this revision Revisions of this file
--- 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) {