aboutsummaryrefslogtreecommitdiff
path: root/src/functiondirectoriesin.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/functiondirectoriesin.cpp')
-rw-r--r--src/functiondirectoriesin.cpp69
1 files changed, 0 insertions, 69 deletions
diff --git a/src/functiondirectoriesin.cpp b/src/functiondirectoriesin.cpp
deleted file mode 100644
index 0ebbbc8..0000000
--- a/src/functiondirectoriesin.cpp
+++ /dev/null
@@ -1,69 +0,0 @@
1#include <dirent.h>
2
3#include "functiondirectoriesin.h"
4#include "bu/plugger.h"
5
6PluginInterface2(directoriesIn, FunctionDirectoriesIn, Function, "Mike Buland", 0, 1 );
7
8FunctionDirectoriesIn::FunctionDirectoriesIn()
9{
10}
11
12FunctionDirectoriesIn::~FunctionDirectoriesIn()
13{
14}
15
16void FunctionDirectoriesIn::execute( Build *bld, const StringList &lInput, StringList &lOutput )
17{
18 DIR *d = opendir( lParams.front().c_str() );
19 if( d == NULL )
20 throw BuildException(
21 "Can't open directory %s.",
22 lParams.front().c_str()
23 );
24
25 struct dirent *e;
26
27 std::string prefix;
28 if( lParams.size() >= 2 )
29 {
30 StringList::iterator i = lParams.begin();
31 i++;
32 prefix = *i;
33 }
34 else
35 {
36 prefix = lParams.front() + "/";
37 }
38
39 while( (e = readdir( d )) )
40 {
41 if( e->d_type == DT_DIR )
42 {
43 if( e->d_name[0] == '.' || e->d_name[0] == '\0' )
44 continue;
45 std::string sOut = prefix + e->d_name;
46 lOutput.push_back( sOut );
47 if( bld )
48 {
49 std::string sV = lParams.front() + "/";
50 sV += e->d_name;
51 bld->set( sOut, "fulldir", sV );
52 }
53 else
54 {
55 printf("no build access.\n");
56 }
57 }
58 }
59
60 closedir( d );
61}
62
63Function *FunctionDirectoriesIn::duplicate( Build &bld, const StringList *cont, VarMap *mExtra )
64{
65 Function *pRet = new FunctionDirectoriesIn();
66 pRet->copyData( this, bld, cont, mExtra );
67 return pRet;
68}
69