diff options
Diffstat (limited to '')
-rw-r--r-- | src/conditionfileexists.cpp | 41 |
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> | ||
9 | using namespace Bu; | ||
10 | |||
11 | #include <bu/plugger.h> | ||
12 | PluginInterface3( pluginConditionFileExists, fileExists, ConditionFileExists, | ||
13 | Condition, "Mike Buland", 0, 1 ); | ||
14 | |||
15 | ConditionFileExists::ConditionFileExists() | ||
16 | { | ||
17 | } | ||
18 | |||
19 | ConditionFileExists::~ConditionFileExists() | ||
20 | { | ||
21 | } | ||
22 | |||
23 | bool 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 | |||
37 | Condition *ConditionFileExists::clone() | ||
38 | { | ||
39 | return new ConditionFileExists(); | ||
40 | } | ||
41 | |||