Use a single implementation and API for copy_file()