X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fcopy.cpp;h=f8c581bd5664ca123f4f657da77883c7dff1003b;hb=f5d3127099bc41f986094eb98732849ee9bfb748;hp=0607b5de5b0d59c0bb3c285f9e0e48fee48eb80c;hpb=9976a7bdf0e53966dce4bc828a37eb42de0223e3;p=builder.git diff --git a/source/copy.cpp b/source/copy.cpp index 0607b5d..f8c581b 100644 --- a/source/copy.cpp +++ b/source/copy.cpp @@ -1,7 +1,16 @@ +/* $Id$ + +This file is part of builder +Copyright © 2006-2007 Mikko Rasa, Mikkosoft Productions +Distributed under the LGPL +*/ + #include #include #include -#include +#include +#include +#include #include "builder.h" #include "copy.h" #include "package.h" @@ -9,53 +18,43 @@ using namespace std; using namespace Msp; -Copy::Copy(Builder &b, const Package &pkg, const Path::Path &s, const Path::Path &d): - Action(b), +Copy::Copy(Builder &b, const Package &pkg, const FS::Path &s, const FS::Path &d): + InternalAction(b), src(s), - dest(d), - worker(0) + dest(d) { announce(pkg.get_name(), "COPY", dest[-1]); if(builder.get_verbose()>=2) cout< "<get_done()) - { - signal_done.emit(); - worker->join(); - return worker->get_error()?1:0; - } - - return -1; -} -Copy::~Copy() +Copy::Worker::Worker(Copy &c): + copy(c) { - delete worker; + launch(); } void Copy::Worker::main() { - Path::mkpath(copy.dest.subpath(0, copy.dest.size()-1), 0755); - - if(unlink(copy.dest.str().c_str())<0 && errno!=ENOENT) + FS::mkpath(FS::dirname(copy.dest), 0755); + + try { - int err=errno; - cerr<<"Can't unlink "<