]> git.tdb.fi Git - builder.git/blobdiff - source/copy.cpp
Move the bpk files into a subdirectory and install them
[builder.git] / source / copy.cpp
index 5b524a40cd367d5e1973c6d2edfacc7d17ef33d5..24be942532b83ab52a0dcfdeb8446ad29d708edf 100644 (file)
@@ -16,11 +16,10 @@ Copy::Copy(Builder &b):
        Tool(b, "CP")
 { }
 
-Target *Copy::create_target(const list<Target *> &sources, const string &arg) const
+Target *Copy::create_target(const list<Target *> &sources, const string &arg)
 {
        FileTarget &file_tgt = dynamic_cast<FileTarget &>(*sources.front());
-       const SourcePackage &pkg = dynamic_cast<const SourcePackage &>(*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;
 }
@@ -88,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());
        }