mirror of
https://github.com/nextcloud/desktop.git
synced 2024-10-25 05:45:42 +03:00
Win32: Add win32 rename function that overwrites existing targets.
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
This commit is contained in:
parent
0bedd5d9a3
commit
44a078b991
1 changed files with 12 additions and 0 deletions
|
@ -338,6 +338,18 @@ int csync_vio_local_stat(const char *uri, csync_vio_file_stat_t *buf) {
|
|||
}
|
||||
|
||||
int csync_vio_local_rename(const char *olduri, const char *newuri) {
|
||||
#ifdef _WIN32
|
||||
if(olduri && newuri) {
|
||||
if (MoveFileEx(olduri, newuri, MOVEFILE_COPY_ALLOWED + MOVEFILE_REPLACE_EXISTING + MOVEFILE_WRITE_THROUGH )) {
|
||||
return 0;
|
||||
}
|
||||
errno = GetLastError();
|
||||
} else {
|
||||
errno = ENOENT;
|
||||
}
|
||||
return -1;
|
||||
#endif
|
||||
|
||||
return rename(olduri, newuri);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue