diff options
Diffstat (limited to 'src/profile.cpp')
-rw-r--r-- | src/profile.cpp | 25 |
1 files changed, 5 insertions, 20 deletions
diff --git a/src/profile.cpp b/src/profile.cpp index 878a6e9..fd21097 100644 --- a/src/profile.cpp +++ b/src/profile.cpp | |||
@@ -4,9 +4,7 @@ | |||
4 | #include "astleaf.h" | 4 | #include "astleaf.h" |
5 | #include "condition.h" | 5 | #include "condition.h" |
6 | 6 | ||
7 | #include "conditionfiletime.h" | 7 | #include "conditionplugger.h" |
8 | #include "conditionalways.h" | ||
9 | #include "conditionnever.h" | ||
10 | 8 | ||
11 | #include <bu/sio.h> | 9 | #include <bu/sio.h> |
12 | using namespace Bu; | 10 | using namespace Bu; |
@@ -64,7 +62,7 @@ Profile *Profile::genDefaultClean() | |||
64 | pAst->openBranch(); | 62 | pAst->openBranch(); |
65 | pAst->addNode( AstNode::typeString, "clean" ); | 63 | pAst->addNode( AstNode::typeString, "clean" ); |
66 | pAst->openBranch(); | 64 | pAst->openBranch(); |
67 | pAst->addNode( AstNode::typeCondition, "always" ); | 65 | pAst->addNode( AstNode::typeCondition, "fileExists" ); |
68 | pAst->addNode( AstNode::typeFunction ); | 66 | pAst->addNode( AstNode::typeFunction ); |
69 | pAst->openBranch(); | 67 | pAst->openBranch(); |
70 | pAst->addNode( AstNode::typeString, "unlink" ); | 68 | pAst->addNode( AstNode::typeString, "unlink" ); |
@@ -89,28 +87,15 @@ void Profile::setCondition() | |||
89 | if( (*i)->getType() == AstNode::typeCondition ) | 87 | if( (*i)->getType() == AstNode::typeCondition ) |
90 | { | 88 | { |
91 | Bu::FString sCond = dynamic_cast<const AstLeaf *>(*i)->getStrValue(); | 89 | Bu::FString sCond = dynamic_cast<const AstLeaf *>(*i)->getStrValue(); |
92 | if( sCond == "filetime" ) | 90 | delete pCond; |
93 | { | 91 | pCond = ConditionPlugger::getInstance().instantiate( sCond ); |
94 | delete pCond; | ||
95 | pCond = new ConditionFileTime(); | ||
96 | } | ||
97 | else if( sCond == "always" ) | ||
98 | { | ||
99 | delete pCond; | ||
100 | pCond = new ConditionAlways(); | ||
101 | } | ||
102 | else if( sCond == "never" ) | ||
103 | { | ||
104 | delete pCond; | ||
105 | pCond = new ConditionNever(); | ||
106 | } | ||
107 | } | 92 | } |
108 | } | 93 | } |
109 | 94 | ||
110 | if( pCond == NULL ) | 95 | if( pCond == NULL ) |
111 | { | 96 | { |
112 | // The default condition | 97 | // The default condition |
113 | pCond = new ConditionFileTime(); | 98 | pCond = ConditionPlugger::getInstance().instantiate("fileTime"); |
114 | } | 99 | } |
115 | } | 100 | } |
116 | 101 | ||