|
a/src/utils/fstreewalk.cpp |
|
b/src/utils/fstreewalk.cpp |
1 |
#ifndef lint
|
1 |
#ifndef lint
|
2 |
static char rcsid[] = "@(#$Id: fstreewalk.cpp,v 1.9 2006-12-21 08:22:35 dockes Exp $ (C) 2004 J.F.Dockes";
|
2 |
static char rcsid[] = "@(#$Id: fstreewalk.cpp,v 1.10 2006-12-21 09:22:31 dockes Exp $ (C) 2004 J.F.Dockes";
|
3 |
#endif
|
3 |
#endif
|
4 |
/*
|
4 |
/*
|
5 |
* This program is free software; you can redistribute it and/or modify
|
5 |
* This program is free software; you can redistribute it and/or modify
|
6 |
* it under the terms of the GNU General Public License as published by
|
6 |
* it under the terms of the GNU General Public License as published by
|
7 |
* the Free Software Foundation; either version 2 of the License, or
|
7 |
* the Free Software Foundation; either version 2 of the License, or
|
|
... |
|
... |
75 |
return data->errors;
|
75 |
return data->errors;
|
76 |
}
|
76 |
}
|
77 |
|
77 |
|
78 |
bool FsTreeWalker::addSkippedName(const string& pattern)
|
78 |
bool FsTreeWalker::addSkippedName(const string& pattern)
|
79 |
{
|
79 |
{
|
|
|
80 |
if (find(data->skippedNames.begin(),
|
|
|
81 |
data->skippedNames.end(), pattern) == data->skippedNames.end())
|
80 |
data->skippedNames.push_back(pattern);
|
82 |
data->skippedNames.push_back(pattern);
|
81 |
return true;
|
83 |
return true;
|
82 |
}
|
84 |
}
|
83 |
bool FsTreeWalker::setSkippedNames(const list<string> &patterns)
|
85 |
bool FsTreeWalker::setSkippedNames(const list<string> &patterns)
|
84 |
{
|
86 |
{
|
85 |
data->skippedNames = patterns;
|
87 |
data->skippedNames = patterns;
|
|
|
88 |
data->skippedNames.sort();
|
|
|
89 |
data->skippedNames.unique();
|
86 |
return true;
|
90 |
return true;
|
87 |
}
|
91 |
}
|
88 |
|
92 |
|
89 |
bool FsTreeWalker::addSkippedPath(const string& path)
|
93 |
bool FsTreeWalker::addSkippedPath(const string& path)
|
90 |
{
|
94 |
{
|
|
|
95 |
if (find(data->skippedPaths.begin(),
|
|
|
96 |
data->skippedPaths.end(), path) == data->skippedPaths.end())
|
91 |
data->skippedPaths.push_back(path_canon(path));
|
97 |
data->skippedPaths.push_back(path_canon(path));
|
92 |
return true;
|
98 |
return true;
|
93 |
}
|
99 |
}
|
94 |
bool FsTreeWalker::setSkippedPaths(const list<string> &paths)
|
100 |
bool FsTreeWalker::setSkippedPaths(const list<string> &paths)
|
95 |
{
|
101 |
{
|
96 |
data->skippedPaths = paths;
|
102 |
data->skippedPaths = paths;
|
97 |
for (list<string>::iterator it = data->skippedPaths.begin();
|
103 |
for (list<string>::iterator it = data->skippedPaths.begin();
|
98 |
it != data->skippedPaths.end(); it++)
|
104 |
it != data->skippedPaths.end(); it++)
|
99 |
*it = path_canon(*it);
|
105 |
*it = path_canon(*it);
|
|
|
106 |
data->skippedPaths.sort();
|
|
|
107 |
data->skippedPaths.unique();
|
100 |
return true;
|
108 |
return true;
|
101 |
}
|
109 |
}
|
102 |
|
110 |
|
103 |
FsTreeWalker::Status FsTreeWalker::walk(const string &top,
|
111 |
FsTreeWalker::Status FsTreeWalker::walk(const string &top,
|
104 |
FsTreeWalkerCB& cb)
|
112 |
FsTreeWalkerCB& cb)
|