#define COPY_H_
#include <msp/core/thread.h>
-#include <msp/path/path.h>
-#include "action.h"
+#include <msp/fs/path.h>
+#include "internaltask.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();
private:
- class Worker: public Msp::Thread
+ /**
+ A worker thread that actually does the data transfer.
+ */
+ class Worker: public InternalTask::Worker
{
- 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 ©
- bool done;
- bool error;
+ const InstalledFile ⌖
- void main();
+ public:
+ Worker(const InstalledFile &);
+ private:
+ virtual void main();
};
- Msp::Path::Path src;
- Msp::Path::Path dest;
- Worker worker;
+public:
+ Copy(Builder &);
+
+ virtual Target *create_target(const std::list<Target *> &, const std::string &);
+ virtual Task *run(const Target &) const;
};
#endif