1 #include <msp/fs/dir.h>
2 #include <msp/fs/stat.h>
3 #include <msp/fs/utils.h>
4 #include <msp/time/utils.h>
5 #include "filetarget.h"
11 void Task::add_target(const FileTarget &t)
13 targets.push_back(&t);
16 void Task::set_unlink(bool u)
23 start_time = Time::now();
25 for(const FileTarget *t: targets)
27 const FS::Path &f = t->get_path();
30 // If the file exists, the directory it's in must exist too
35 FS::Path dir = FS::dirname(f);
37 FS::mkpath(dir, 0755);
42 void Task::finished(bool success)
44 if(!duration && start_time)
45 duration = Time::now()-start_time;
46 signal_finished.emit(success);