216
216
//----------------------------------------------------------------------------
217
217
void Glob::RecurseDirectory(kwsys_stl::string::size_type start,
218
const kwsys_stl::string& dir, bool dir_only)
218
const kwsys_stl::string& dir)
220
220
kwsys::Directory d;
221
221
if ( !d.Load(dir.c_str()) )
258
258
fullname = dir + "/" + fname;
261
if ( !dir_only || !kwsys::SystemTools::FileIsDirectory(realname.c_str()) )
263
if ( (this->Internals->Expressions.size() > 0) &&
261
bool isDir = kwsys::SystemTools::FileIsDirectory(realname.c_str());
262
bool isSymLink = kwsys::SystemTools::FileIsSymlink(realname.c_str());
264
if ( isDir && (!isSymLink || this->RecurseThroughSymlinks) )
268
++this->FollowedSymlinkCount;
270
this->RecurseDirectory(start+1, realname);
274
if ( (this->Internals->Expressions.size() > 0) &&
264
275
this->Internals->Expressions[
265
276
this->Internals->Expressions.size()-1].find(fname.c_str()) )
267
278
this->AddFile(this->Internals->Files, realname.c_str());
270
if ( kwsys::SystemTools::FileIsDirectory(realname.c_str()) )
272
bool isSymLink = kwsys::SystemTools::FileIsSymlink(realname.c_str());
273
if (!isSymLink || this->RecurseThroughSymlinks)
277
++this->FollowedSymlinkCount;
279
this->RecurseDirectory(start+1, realname, dir_only);
285
284
//----------------------------------------------------------------------------
286
285
void Glob::ProcessDirectory(kwsys_stl::string::size_type start,
287
const kwsys_stl::string& dir, bool dir_only)
286
const kwsys_stl::string& dir)
289
288
//kwsys_ios::cout << "ProcessDirectory: " << dir << kwsys_ios::endl;
290
289
bool last = ( start == this->Internals->Expressions.size()-1 );
291
290
if ( last && this->Recurse )
293
this->RecurseDirectory(start, dir, dir_only);
292
this->RecurseDirectory(start, dir);
345
344
// << this->Internals->TextExpressions[start].c_str() << kwsys_ios::endl;
346
345
//kwsys_ios::cout << "Full name: " << fullname << kwsys_ios::endl;
348
if ( (!dir_only || !last) &&
349
348
!kwsys::SystemTools::FileIsDirectory(realname.c_str()) )
462
461
// Handle network paths
465
this->ProcessDirectory(0, fexpr.substr(0, skip) + "/",
464
this->ProcessDirectory(0, fexpr.substr(0, skip) + "/");
470
this->ProcessDirectory(0, "/", true);
468
this->ProcessDirectory(0, "/");