]> git.tdb.fi Git - builder.git/blobdiff - source/task.cpp
Use default member initializers and constructor delegation
[builder.git] / source / task.cpp
index f6fa7b283e6c9b69b6c50cb9ad2d7d3707ac621f..e72a7415de285767ee93369051fb384113b8d2a1 100644 (file)
@@ -3,15 +3,12 @@
 #include <msp/fs/utils.h>
 #include "task.h"
 
+using namespace std;
 using namespace Msp;
 
-Task::Task():
-       unlink(false)
-{ }
-
-void Task::set_file(const FS::Path &f)
+void Task::add_file(const FS::Path &f)
 {
-       file = f;
+       files.push_back(f);
 }
 
 void Task::set_unlink(bool u)
@@ -21,16 +18,16 @@ void Task::set_unlink(bool u)
 
 void Task::prepare()
 {
-       if(!file.empty())
+       for(const FS::Path &f: files)
        {
-               if(FS::exists(file))
+               if(FS::exists(f))
                {
                        // If the file exists, the directory it's in must exist too
-                       FS::unlink(file);
+                       FS::unlink(f);
                }
                else
                {
-                       FS::Path dir = FS::dirname(file);
+                       FS::Path dir = FS::dirname(f);
                        if(!FS::exists(dir))
                                FS::mkpath(dir, 0755);
                }