X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fcopy.cpp;h=24be942532b83ab52a0dcfdeb8446ad29d708edf;hb=68f084e4ed817da0c25cefa1772cadf97b8cfe5e;hp=0073320504b0daff45e2c9577a93e9ab4c095dff;hpb=ad88e1ba08cf798e5f87796021c947cf500a02e1;p=builder.git diff --git a/source/copy.cpp b/source/copy.cpp index 0073320..24be942 100644 --- a/source/copy.cpp +++ b/source/copy.cpp @@ -16,7 +16,7 @@ Copy::Copy(Builder &b): Tool(b, "CP") { } -Target *Copy::create_target(const list &sources, const string &arg) const +Target *Copy::create_target(const list &sources, const string &arg) { FileTarget &file_tgt = dynamic_cast(*sources.front()); InstalledFile *inst = new InstalledFile(builder, *file_tgt.get_package(), file_tgt, arg); @@ -87,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()); }