]> git.tdb.fi Git - builder.git/blobdiff - source/unlink.cpp
Fix a problem in finding ObjectFile dependencies
[builder.git] / source / unlink.cpp
index b9357e64e5af3889b23227d22a3432610d1a7556..fbe6388c90bacf02532f1a43e65bec73a903cd25 100644 (file)
@@ -1,23 +1,28 @@
 /* $Id$
 
 This file is part of builder
-Copyright © 2006-2007 Mikko Rasa, Mikkosoft Productions
+Copyright © 2007-2009  Mikko Rasa, Mikkosoft Productions
 Distributed under the LGPL
 */
 
-#include <msp/path/utils.h>
-#include "package.h"
-#include "target.h"
+#include <msp/fs/utils.h>
+#include "filetarget.h"
+#include "sourcepackage.h"
 #include "unlink.h"
 
-Unlink::Unlink(Builder &b, const Target &t):
+Unlink::Unlink(Builder &b, const FileTarget &t):
        Action(b)
 {
-       const Package &pkg=*t.get_package();
+       const SourcePackage &spkg=*static_cast<const SourcePackage *>(t.get_package());
 
-       announce(pkg.get_name(), "RM", relative(t.get_name(), pkg.get_source()).str());
+       announce(spkg.get_name(), "RM", relative(t.get_path(), spkg.get_source()).str());
 
-       unlink(t.get_name().c_str());
+       try
+       {
+               unlink(t.get_path());
+       }
+       catch(const Msp::SystemError &)
+       { }
 }
 
 int Unlink::check()