X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fcopy.cpp;h=75d047df7ef50c6371835f456a747f2c34b6121a;hb=08015c0f27f377fcd4aa186fca5bd8cf70723a5a;hp=30ab60e446b6ae8353112a5e707a8fb21ddf7355;hpb=4a46970b4a036e432d0bf7af5d5960ddf59082d3;p=builder.git diff --git a/source/copy.cpp b/source/copy.cpp index 30ab60e..75d047d 100644 --- a/source/copy.cpp +++ b/source/copy.cpp @@ -19,8 +19,7 @@ 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()); - InstalledFile *inst = new InstalledFile(builder, pkg, file_tgt, arg); + InstalledFile *inst = new InstalledFile(builder, *file_tgt.get_package(), file_tgt, arg); inst->set_tool(*this); return inst; } @@ -35,9 +34,7 @@ Task *Copy::run(const Target &target) const 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()); }