- barf_or_query_if_file_exists (newname, "copy to it",
- INTEGERP (ok_if_already_exists), &out_st, 0);
- else if (stat (SSDATA (encoded_newname), &out_st) < 0)
- out_st.st_mode = 0;
-
-#ifdef WINDOWSNT
- if (!NILP (preserve_extended_attributes))
- {
- acl = acl_get_file (SDATA (encoded_file), ACL_TYPE_ACCESS);
- if (acl == NULL && acl_errno_valid (errno))
- report_file_error ("Getting ACL", file);
- }
- if (!CopyFile (SDATA (encoded_file),
- SDATA (encoded_newname),
- FALSE))
- {
- /* CopyFile doesn't set errno when it fails. By far the most
- "popular" reason is that the target is read-only. */
- report_file_errno ("Copying file", list2 (file, newname),
- GetLastError () == 5 ? EACCES : EPERM);
- }
- /* CopyFile retains the timestamp by default. */
- else if (NILP (keep_time))
- {
- struct timespec now;
- DWORD attributes;
- char * filename;
-
- filename = SDATA (encoded_newname);
+ barf_or_query_if_file_exists (newname, false, "copy to it",
+ INTEGERP (ok_if_already_exists), false);