3 #include <msp/path/utils.h>
11 Copy::Copy(Builder &b, const Package &pkg, const Path::Path &s, const Path::Path &d):
17 announce(pkg.get_name(), "INST", dest[-1]);
18 if(builder.get_verbose()>=2)
19 cout<<s<<" -> "<<d<<'\n';
28 return worker.get_error()?1:0;
33 void Copy::Worker::main()
35 Path::mkpath(copy.src.subpath(0, copy.src.size()-1), 0755);
36 if(unlink(copy.dest.str().c_str())<0 && errno!=ENOENT)
39 cerr<<"Can't unlink "<<copy.dest<<": "<<strerror(err)<<'\n';
44 ifstream in(copy.src.str().c_str());
47 cerr<<"Can't open "<<copy.src<<" for reading\n";
52 ofstream out(copy.dest.str().c_str());
55 cerr<<"Can't open "<<copy.dest<<" for writing\n";
63 in.read(buf, sizeof(buf));
64 out.write(buf, in.gcount());
68 Path::stat(copy.src, st);
69 chmod(copy.dest.str().c_str(), st.st_mode&0777);