X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fcopy.cpp;h=2d2a7ca9c023c557954e05924d9181f4280dae97;hb=HEAD;hp=23cd6f1af358cebb11e9e526a7ede7ef1af4ef0b;hpb=0d80cabf649b931b26e7055385156c75a7385d35;p=builder.git diff --git a/source/copy.cpp b/source/copy.cpp deleted file mode 100644 index 23cd6f1..0000000 --- a/source/copy.cpp +++ /dev/null @@ -1,48 +0,0 @@ -#include -#include -#include "copy.h" -#include "package.h" - -using namespace std; -using namespace Msp; - -Copy::Copy(Builder &b, const Package &pkg, const Path::Path &s, const Path::Path &d): - Action(b), - src(s), - dest(d), - worker(*this) -{ - announce(pkg.get_name(), "INST", dest[-1]); -} - -int Copy::check() -{ - if(worker.get_done()) - { - signal_done.emit(); - worker.join(); - return 0; - } - return -1; -} - -void Copy::Worker::main() -{ - Path::mkpath(copy.src.subpath(0, copy.src.size()-1), 0755); - unlink(copy.dest.str().c_str()); - ifstream in(copy.src.str().c_str()); - ofstream out(copy.dest.str().c_str()); - - char buf[16384]; - while(!in.eof()) - { - in.read(buf, sizeof(buf)); - out.write(buf, in.gcount()); - } - - struct stat st; - Path::stat(copy.src, st); - chmod(copy.dest.str().c_str(), st.st_mode&0777); - - done=true; -}