X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fcopy.cpp;h=75d047df7ef50c6371835f456a747f2c34b6121a;hb=b58e16b078df97d8aabf64a8e4d0d8ce37ad3877;hp=b5ac403c4d4eb72e42567122bb656d576287bb5a;hpb=338eefb513953ae55e8e3614c009c242ba8ad74e;p=builder.git diff --git a/source/copy.cpp b/source/copy.cpp index b5ac403..75d047d 100644 --- a/source/copy.cpp +++ b/source/copy.cpp @@ -1,4 +1,4 @@ -#include +#include #include #include #include @@ -7,7 +7,7 @@ #include #include "builder.h" #include "copy.h" -#include "install.h" +#include "installedfile.h" using namespace std; using namespace Msp; @@ -19,25 +19,22 @@ Copy::Copy(Builder &b): Target *Copy::create_target(const list &sources, const string &arg) const { FileTarget &file_tgt = dynamic_cast(*sources.front()); - const SourcePackage &pkg = dynamic_cast(*file_tgt.get_package()); - Install *inst = new Install(builder, pkg, file_tgt, arg); + InstalledFile *inst = new InstalledFile(builder, *file_tgt.get_package(), file_tgt, arg); inst->set_tool(*this); return inst; } Task *Copy::run(const Target &target) const { - const Install &install = dynamic_cast(target); + const InstalledFile &install = dynamic_cast(target); Worker *worker = new Worker(install); return new InternalTask(worker); } -Copy::Worker::Worker(const Install &t): +Copy::Worker::Worker(const InstalledFile &t): target(t) -{ - launch(); -} +{ } void Copy::Worker::main() { @@ -90,6 +87,8 @@ void Copy::Worker::main() if(!link.empty()) { FS::Path relpath = FS::relative(dst_path, FS::dirname(link)); + if(FS::exists(link)) + FS::unlink(link); symlink(relpath.str().c_str(), link.str().c_str()); }