diff options
Diffstat (limited to '')
-rw-r--r-- | src/functionexists.cpp | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/src/functionexists.cpp b/src/functionexists.cpp new file mode 100644 index 0000000..d2aa9e9 --- /dev/null +++ b/src/functionexists.cpp | |||
@@ -0,0 +1,34 @@ | |||
1 | #include "functionexists.h" | ||
2 | |||
3 | #include <unistd.h> | ||
4 | |||
5 | FunctionExists::FunctionExists() | ||
6 | { | ||
7 | } | ||
8 | |||
9 | FunctionExists::~FunctionExists() | ||
10 | { | ||
11 | } | ||
12 | |||
13 | Bu::FString FunctionExists::getName() const | ||
14 | { | ||
15 | return "exists"; | ||
16 | } | ||
17 | |||
18 | Variable FunctionExists::call( Variable &input, VarList lParams ) | ||
19 | { | ||
20 | Bu::FString sFile; | ||
21 | if( input.getType() != Variable::typeNone ) | ||
22 | { | ||
23 | sFile = input.toString(); | ||
24 | } | ||
25 | else | ||
26 | { | ||
27 | sFile = lParams.first().toString(); | ||
28 | } | ||
29 | if( access( sFile.getStr(), F_OK ) == 0 ) | ||
30 | return Variable( true ); | ||
31 | else | ||
32 | return Variable( false ); | ||
33 | } | ||
34 | |||