aboutsummaryrefslogtreecommitdiff
path: root/src/conditionfileexists.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/conditionfileexists.cpp')
-rw-r--r--src/conditionfileexists.cpp41
1 files changed, 41 insertions, 0 deletions
diff --git a/src/conditionfileexists.cpp b/src/conditionfileexists.cpp
new file mode 100644
index 0000000..0585351
--- /dev/null
+++ b/src/conditionfileexists.cpp
@@ -0,0 +1,41 @@
1#include "conditionfileexists.h"
2#include "target.h"
3
4#include <sys/types.h>
5#include <sys/stat.h>
6#include <unistd.h>
7
8#include <bu/sio.h>
9using namespace Bu;
10
11#include <bu/plugger.h>
12PluginInterface3( pluginConditionFileExists, fileExists, ConditionFileExists,
13 Condition, "Mike Buland", 0, 1 );
14
15ConditionFileExists::ConditionFileExists()
16{
17}
18
19ConditionFileExists::~ConditionFileExists()
20{
21}
22
23bool ConditionFileExists::shouldExec( class Runner &r, Target &rTarget )
24{
25 for( StrList::const_iterator j = rTarget.getOutputList().begin(); j; j++ )
26 {
27 // If any input exists, then return true, we should exec.
28 if( !access( (*j).getStr(), F_OK ) )
29 {
30 return true;
31 }
32 }
33
34 return false;
35}
36
37Condition *ConditionFileExists::clone()
38{
39 return new ConditionFileExists();
40}
41