}
}
+// XXX character encoding.
void
copy_file(const path & from_path, const path & to_path)
{
- // this implementation could use mucho memory
- // for big files.
std::ifstream in(from_path.to_string().c_str());
std::ofstream out(to_path.to_string().c_str());
out << in.rdbuf();
if (!in || !out) {
+ remove (to_path);
throw filesystem_error(string_compose(_("Could not copy existing file %1 to %2"),
from_path.to_string(), to_path.to_string()));
- remove (to_path);
}
}