summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteve Huston <shuston@riverace.com>2000-06-21 18:29:49 +0000
committerSteve Huston <shuston@riverace.com>2000-06-21 18:29:49 +0000
commit956a7b59f962a7ba331d75eec0b10efa5c826130 (patch)
tree8bde3eb00261560ab7ce42e003f3d302845776fe
parent1e9d3ae325ba65dfb95f782af9371af767452393 (diff)
downloadATCD-956a7b59f962a7ba331d75eec0b10efa5c826130.tar.gz
ChangeLogTag:Wed Jun 21 13:25:41 2000 Steve Huston <shuston@riverace.com>
-rw-r--r--ace/OS.i20
1 files changed, 19 insertions, 1 deletions
diff --git a/ace/OS.i b/ace/OS.i
index 5f6f5cb91fd..d8d73cbcde2 100644
--- a/ace/OS.i
+++ b/ace/OS.i
@@ -1126,14 +1126,32 @@ ACE_OS::unlink (const ACE_TCHAR *path)
}
ACE_INLINE int
-ACE_OS::rename (const ACE_TCHAR *old_name, const ACE_TCHAR *new_name)
+ACE_OS::rename (const ACE_TCHAR *old_name,
+ const ACE_TCHAR *new_name,
+ int flags)
{
# if (ACE_LACKS_RENAME)
ACE_UNUSED_ARG (old_name);
ACE_UNUSED_ARG (new_name);
+ ACE_UNUSED_ARG (flags);
ACE_NOTSUP_RETURN (-1);
# elif defined (ACE_HAS_WINCE)
+ ACE_UNUSED_ARG (flags);
+ // *** this looks wrong... should be???
+ // if (MoveFile (old_name, new_name) != 0)
+ // ACE_FAIL_RETURN (-1);
+ // return 0;
ACE_OSCALL_RETURN (::MoveFile (new_name, old_name), int, -1);
+# elif defined (ACE_WIN32)&& defined (ACE_HAS_WINNT4)
+ // NT4 (and up) provides a way to rename/move a file with similar semantics
+ // to what's usually done on UNIX - if there's an existing file with
+ // <new_name> it is removed before the file is renamed/moved. The
+ // MOVEFILE_COPY_ALLOWED is specified to allow such a rename across drives.
+ if (flags == -1)
+ flags = MOVEFILE_COPY_ALLOWED | MOVEFILE_REPLACE_EXISTING;
+ if (::MoveFileEx(old_name, new_name, flags) == 0)
+ ACE_FAIL_RETURN (-1);
+ return 0;
# elif defined (ACE_WIN32) && defined (ACE_USES_WCHAR)
ACE_OSCALL_RETURN (::_wrename (old_name, new_name), int, -1);
# else /* ACE_LACKS_RENAME */