diff options
Diffstat (limited to 'src/functionfilesin.cpp')
-rw-r--r-- | src/functionfilesin.cpp | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/functionfilesin.cpp b/src/functionfilesin.cpp index 0d65c13..3e1233a 100644 --- a/src/functionfilesin.cpp +++ b/src/functionfilesin.cpp | |||
@@ -1,5 +1,8 @@ | |||
1 | #include <dirent.h> | ||
2 | |||
1 | #include "functionfilesin.h" | 3 | #include "functionfilesin.h" |
2 | #include "plugger.h" | 4 | #include "plugger.h" |
5 | #include "build.h" | ||
3 | 6 | ||
4 | PluginInterface2(filesIn, FunctionFilesIn, Function, "Mike Buland", 0, 1 ); | 7 | PluginInterface2(filesIn, FunctionFilesIn, Function, "Mike Buland", 0, 1 ); |
5 | 8 | ||
@@ -13,5 +16,25 @@ FunctionFilesIn::~FunctionFilesIn() | |||
13 | 16 | ||
14 | void FunctionFilesIn::execute( const StringList &lInput, StringList &lOutput ) | 17 | void FunctionFilesIn::execute( const StringList &lInput, StringList &lOutput ) |
15 | { | 18 | { |
19 | DIR *d = opendir( lParams.front().c_str() ); | ||
20 | if( d == NULL ) | ||
21 | throw BuildException( | ||
22 | "Can't open directory %s.", | ||
23 | lParams.front().c_str() | ||
24 | ); | ||
25 | |||
26 | struct dirent *e; | ||
27 | |||
28 | std::string prefix = lParams.front() + "/"; | ||
29 | |||
30 | while( (e = readdir( d )) ) | ||
31 | { | ||
32 | if( e->d_type == DT_REG ) | ||
33 | { | ||
34 | lOutput.push_back( prefix + e->d_name ); | ||
35 | } | ||
36 | } | ||
37 | |||
38 | closedir( d ); | ||
16 | } | 39 | } |
17 | 40 | ||