Commit | Line | Data |
---|---|---|
7f918cf1 CE |
1 | #include "platform.h" |
2 | ||
3 | C_Errno_t(C_Int_t) Posix_FileSys_rename (NullString8_t p1, NullString8_t p2) { | |
4 | C_Errno_t(C_Int_t) res; | |
5 | res = rename ((const char *) p1, (const char *) p2); | |
6 | #ifdef __MINGW32__ | |
7 | /* the MinGW rename() function does not remove the destination file | |
8 | * if it exists; we emulate the Unix behavior here. | |
9 | */ | |
10 | if ((res != 0) && (errno == EEXIST)) { | |
11 | res = unlink ((const char *) p2); | |
12 | if (res == 0) | |
13 | res = rename((const char *) p1, (const char *) p2); | |
14 | } | |
15 | #endif | |
16 | return res; | |
17 | } |