#ifndef COPY_H_
#define COPY_H_
-#include <msp/core/thread.h>
-#include <msp/path/path.h>
-#include "action.h"
+#include "tool.h"
-class Copy: public Action
+class InstalledFile;
+
+/**
+Copies a file to another place. Used by the InstalledFile target.
+*/
+class Copy: public Tool
{
public:
- Copy(Builder &, const Msp::Path::Path &, const Msp::Path::Path &);
- int check();
-private:
- class Worker: public Msp::Thread
- {
- public:
- Worker(Copy &i): copy(i), done(false) { launch(); }
- bool get_done() const { return done; }
- private:
- Copy ©
- bool done;
+ Copy(Builder &b): Tool(b, "CP") { }
- void main();
- };
+ Target *create_target(const std::vector<Target *> &, const std::string &) override;
+ Task *run(const Target &) const override;
- Msp::Path::Path src;
- Msp::Path::Path dest;
- Worker worker;
+private:
+ static bool _run(const InstalledFile &);
};
#endif