diff options
Diffstat (limited to 'Source/cmSystemTools.cxx')
-rw-r--r-- | Source/cmSystemTools.cxx | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx index 29d96ea..f8e1874 100644 --- a/Source/cmSystemTools.cxx +++ b/Source/cmSystemTools.cxx @@ -1305,3 +1305,37 @@ void cmSystemTools::Glob(const char *directory, const char *regexp, } } + +void cmSystemTools::GlobDirs(const char *fullPath, + std::vector<std::string>& files) +{ + std::string path = fullPath; + int pos = path.find("/*"); + if(pos == std::string::npos) + { + files.push_back(fullPath); + return; + } + std::string startPath = path.substr(0, pos); + std::string finishPath = path.substr(pos+2); + + cmDirectory d; + if (d.Load(startPath.c_str())) + { + for (int i = 0; i < d.GetNumberOfFiles(); ++i) + { + if((std::string(d.GetFile(i)) != ".") + && (std::string(d.GetFile(i)) != "..")) + { + std::string fname = startPath; + fname +="/"; + fname += d.GetFile(i); + if(cmSystemTools::FileIsDirectory(fname.c_str())) + { + fname += finishPath; + cmSystemTools::GlobDirs(fname.c_str(), files); + } + } + } + } +} |