#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)
void Task::prepare()
{
- if(!file.empty())
+ for(list<FS::Path>::const_iterator i=files.begin(); i!=files.end(); ++i)
{
- if(FS::exists(file))
+ if(FS::exists(*i))
{
// If the file exists, the directory it's in must exist too
- FS::unlink(file);
+ FS::unlink(*i);
}
else
{
- FS::Path dir = FS::dirname(file);
+ FS::Path dir = FS::dirname(*i);
if(!FS::exists(dir))
FS::mkpath(dir, 0755);
}