X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fcopy.cpp;h=f8c581bd5664ca123f4f657da77883c7dff1003b;hb=f52ca29f2357618da9e87a08bfd61f8a0058a8e1;hp=eea40fcdae6eda6f63dc30f09988736fa88a7fbc;hpb=ab25857fd626152bc9a2832de82b400c062857e6;p=builder.git diff --git a/source/copy.cpp b/source/copy.cpp index eea40fc..f8c581b 100644 --- a/source/copy.cpp +++ b/source/copy.cpp @@ -8,7 +8,9 @@ Distributed under the LGPL #include #include #include -#include +#include +#include +#include #include "builder.h" #include "copy.h" #include "package.h" @@ -16,7 +18,7 @@ Distributed under the LGPL using namespace std; using namespace Msp; -Copy::Copy(Builder &b, const Package &pkg, const Path::Path &s, const Path::Path &d): +Copy::Copy(Builder &b, const Package &pkg, const FS::Path &s, const FS::Path &d): InternalAction(b), src(s), dest(d) @@ -38,15 +40,21 @@ Copy::Worker::Worker(Copy &c): void Copy::Worker::main() { - Path::mkpath(copy.dest.subpath(0, copy.dest.size()-1), 0755); + FS::mkpath(FS::dirname(copy.dest), 0755); - // Remove old file. Not doing this would cause Bad Stuff when installing libraries. - if(unlink(copy.dest.str().c_str())<0 && errno!=ENOENT) + try { - int err=errno; - cerr<<"Can't unlink "<