Mercurial > emacs
comparison src/fileio.c @ 37292:80082652ed9f
(Fcopy_file) [WINDOWSNT]: Use CopyFile.
author | Gerd Moellmann <gerd@gnu.org> |
---|---|
date | Tue, 10 Apr 2001 12:15:53 +0000 |
parents | 98458fd6ac46 |
children | 2db1b1bb1d18 |
comparison
equal
deleted
inserted
replaced
37291:83dd2eb5365f | 37292:80082652ed9f |
---|---|
2332 barf_or_query_if_file_exists (encoded_newname, "copy to it", | 2332 barf_or_query_if_file_exists (encoded_newname, "copy to it", |
2333 INTEGERP (ok_if_already_exists), &out_st, 0); | 2333 INTEGERP (ok_if_already_exists), &out_st, 0); |
2334 else if (stat (XSTRING (encoded_newname)->data, &out_st) < 0) | 2334 else if (stat (XSTRING (encoded_newname)->data, &out_st) < 0) |
2335 out_st.st_mode = 0; | 2335 out_st.st_mode = 0; |
2336 | 2336 |
2337 #ifdef WINDOWSNT | |
2338 if (!CopyFile (XSTRING (encoded_file)->data, | |
2339 XSTRING (encoded_newname)->data, | |
2340 FALSE)) | |
2341 report_file_error ("Copying file", Fcons (file, Fcons (newname, Qnil))); | |
2342 else if (NILP (keep_time)) | |
2343 { | |
2344 EMACS_TIME now; | |
2345 EMACS_GET_TIME (now); | |
2346 if (set_file_times (XSTRING (encoded_newname)->data, | |
2347 now, now)) | |
2348 Fsignal (Qfile_date_error, | |
2349 Fcons (build_string ("Cannot set file date"), | |
2350 Fcons (newname, Qnil))); | |
2351 } | |
2352 #else /* not WINDOWSNT */ | |
2337 ifd = emacs_open (XSTRING (encoded_file)->data, O_RDONLY, 0); | 2353 ifd = emacs_open (XSTRING (encoded_file)->data, O_RDONLY, 0); |
2338 if (ifd < 0) | 2354 if (ifd < 0) |
2339 report_file_error ("Opening input file", Fcons (file, Qnil)); | 2355 report_file_error ("Opening input file", Fcons (file, Qnil)); |
2340 | 2356 |
2341 record_unwind_protect (close_file_unwind, make_number (ifd)); | 2357 record_unwind_protect (close_file_unwind, make_number (ifd)); |
2421 #endif /* DJGPP version 2 or newer */ | 2437 #endif /* DJGPP version 2 or newer */ |
2422 #endif /* MSDOS */ | 2438 #endif /* MSDOS */ |
2423 } | 2439 } |
2424 | 2440 |
2425 emacs_close (ifd); | 2441 emacs_close (ifd); |
2442 #endif /* WINDOWSNT */ | |
2426 | 2443 |
2427 /* Discard the unwind protects. */ | 2444 /* Discard the unwind protects. */ |
2428 specpdl_ptr = specpdl + count; | 2445 specpdl_ptr = specpdl + count; |
2429 | 2446 |
2430 UNGCPRO; | 2447 UNGCPRO; |