Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: XRangePingPong XRange-LoRaWAN-lmic-app lora-transceiver
Diff: common/retarget.cpp
- 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) {