-/* $Id$
-
-This file is part of builder
-Copyright © 2006-2009 Mikko Rasa, Mikkosoft Productions
-Distributed under the LGPL
-*/
-
#include <errno.h>
#include <sys/stat.h>
#include <msp/fs/dir.h>
using namespace std;
using namespace Msp;
-Copy::Copy(Builder &b, const Package &pkg, const FS::Path &s, const FS::Path &d):
+Copy::Copy(Builder &b, const Package &pkg, const FS::Path &s, const FS::Path &d, const FS::Path &l):
InternalAction(b),
src(s),
- dest(d)
+ dest(d),
+ link(l)
{
announce(pkg.get_name(), "COPY", dest.str());
if(builder.get_verbose()>=2)
if(stat(copy.src.str().c_str(), &st)==0)
chmod(copy.dest.str().c_str(), st.st_mode&0777);
+ if(!copy.link.empty())
+ {
+ FS::Path relpath = FS::relative(copy.dest, FS::dirname(copy.link));
+ symlink(relpath.str().c_str(), copy.link.str().c_str());
+ }
+
done = true;
}