]> git.tdb.fi Git - builder.git/blobdiff - source/copy.h
Redesign how tools are run
[builder.git] / source / copy.h
index 3f92b155f4960038ccc7a5341586d27bb870d7b0..d65bb05a0c70e62b87382cea20fb16950b8b5061 100644 (file)
@@ -1,36 +1,22 @@
 #ifndef COPY_H_
 #define COPY_H_
 
-#include <msp/core/thread.h>
-#include <msp/path/path.h>
-#include "action.h"
+#include "tool.h"
 
-class Package;
+class InstalledFile;
 
-class Copy: public Action
+/**
+Copies a file to another place.  Used by the InstalledFile target.
+*/
+class Copy: public Tool
 {
 public:
-       Copy(Builder &, const Package &, const Msp::Path::Path &, const Msp::Path::Path &);
-       int check();
-       ~Copy();
-private:
-       class Worker: public Msp::Thread
-       {
-       public:
-               Worker(Copy &i): copy(i), done(false), error(false) { launch(); }
-               bool get_done() const  { return done; }
-               bool get_error() const { return error; }
-       private:
-               Copy &copy;
-               bool done;
-               bool error;
+       Copy(Builder &);
 
-               void main();
-       };
+       Target *create_target(const std::vector<Target *> &, const std::string &) override;
 
-       Msp::Path::Path src;
-       Msp::Path::Path dest;
-       Worker *worker;
+private:
+       static bool _run(const InstalledFile &);
 };
 
 #endif