View | Details | Raw Unified
Collapse All | Expand All

(-) par2cmdline-0.4/diskfile.cpp (-9 / +11 lines)
 Lines 618-623    Link Here 
  return result;
  return result;
}
}
bool is_regular_file(const string &p)
{
  struct stat st;
  return (stat(p.c_str(), &st) == 0 && S_ISREG(st.st_mode));
}
list<string>* DiskFile::FindFiles(string path, string wildcard)
list<string>* DiskFile::FindFiles(string path, string wildcard)
{
{
  list<string> *matches = new list<string>;
  list<string> *matches = new list<string>;
 Lines 646-652    Link Here 
        {
        {
          if (name.size() >= wildcard.size() &&
          if (name.size() >= wildcard.size() &&
              name.substr(0, where) == front &&
              name.substr(0, where) == front &&
              name.substr(name.size()-back.size()) == back)
              name.substr(name.size()-back.size()) == back &&
              is_regular_file(path + name))
          {
          {
            matches->push_back(path + name);
            matches->push_back(path + name);
          }
          }
 Lines 665-671    Link Here 
              ++pn;
              ++pn;
            }
            }
            if (pw == wildcard.end())
            if (pw == wildcard.end() && is_regular_file(path + name))
            {
            {
              matches->push_back(path + name);
              matches->push_back(path + name);
            }
            }
 Lines 676-689    Link Here 
      closedir(dirp);
      closedir(dirp);
    }
    }
  }
  }
  else
  else if (is_regular_file(path + wildcard))
  {
  {
    struct stat st;
    matches->push_back(path + wildcard);
    string fn = path + wildcard;
    if (stat(fn.c_str(), &st) == 0)
    {
      matches->push_back(path + wildcard);
    }
  }
  }
  return matches;
  return matches;