MCPcopy Create free account
hub / github.com/NetHack/NetHack / copy_file

Function copy_file

sys/windows/windmain.c:699–721  ·  view source on GitHub ↗

copy file if destination does not exist */

Source from the content-addressed store, hash-verified

697
698/* copy file if destination does not exist */
699void
700copy_file(const char *dst_folder, const char *dst_name,
701 const char *src_folder, const char *src_name,
702 boolean copy_even_if_it_exists)
703{
704 char dst_path[MAX_PATH];
705 strcpy(dst_path, dst_folder);
706 strcat(dst_path, dst_name);
707
708 char src_path[MAX_PATH];
709 strcpy(src_path, src_folder);
710 strcat(src_path, src_name);
711
712 if (!file_exists(src_path))
713 error("Unable to copy file '%s' as it does not exist", src_path);
714
715 if (file_exists(dst_path) && !copy_even_if_it_exists)
716 return;
717
718 BOOL success = CopyFileA(src_path, dst_path, !copy_even_if_it_exists);
719 if (!success)
720 error("Failed to copy '%s' to '%s' (%d)", src_path, dst_path, errno);
721}
722
723/* update file copying if it does not exist or src is newer then dst */
724void

Callers 3

copy_symbols_contentFunction · 0.70
copy_sysconf_contentFunction · 0.70
copy_config_contentFunction · 0.70

Calls 2

file_existsFunction · 0.70
errorFunction · 0.50

Tested by

no test coverage detected