std::vector<std::string> Directory::getDirectories(const std::string& path, const std::string& pattern)
{
  std::vector<std::string> dirs;
  FileSystemSearch fss;
  std::string pdir = fss.firstDirectory(path, pattern);
  std::string dir = FileSystem::Path::getFullFileSpec(pdir);
  if(pdir.size() == 0)
    return dirs;
  dirs.push_back(dir);
  int i = 0;
  while(true)
  {
	  if (i ==0)
	  {
		  pdir = fss.nextDirectory();
		  std::string dir = FileSystem::Path::getFullFileSpec(pdir);
		  if (pdir.size() == 0)
			  return dirs;
		  dirs.push_back(dir);
	  }
	  else
	  {
		  pdir = fss.nextDirectory();
		  std::string dir = path +"\\"+ pdir+"\\";
		  if (pdir.size() == 0)
			  return dirs;
		  dirs.push_back(dir);
	  }
	i++;
  }
  return dirs;
}
示例#2
0
std::vector<std::string> Directory::getDirectories(const std::string& path, const std::string& pattern)
{
	std::vector<std::string> dirs;
	FileSystemSearch fss;
	std::string dir = fss.firstDirectory(path, pattern);
	if (dir.size() == 0)
		return dirs;
	dirs.push_back(dir);
	while (true)
	{
		dir = fss.nextDirectory();
		if (dir.size() == 0)
			return dirs;
		dirs.push_back(dir);
	}
	return dirs;
}
示例#3
0
std::vector<std::string> Directory::getFiles(const std::string& path, const std::string& pattern)
{
	std::vector<std::string> files;
	FileSystemSearch fss;
	std::string file = fss.firstFile(path, pattern);
	if (file.size() == 0)
		return files;
	files.push_back(file);
	while (true)
	{
		file = fss.nextFile();
		if (file.size() == 0)
			return files;
		files.push_back(file);
	}
	return files;
}