View | Details | Raw Unified
Collapse All | Expand All

(-) par2cmdline-0.4/diskfile.cpp (-5 / +30 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 648-654    Link Here 
              name.substr(0, where) == front &&
              name.substr(0, where) == front &&
              name.substr(name.size()-back.size()) == back)
              name.substr(name.size()-back.size()) == back)
          {
          {
            matches->push_back(path + name);
            if (is_regular_file(path + name))
            {
              matches->push_back(path + name);
            }
            else
            {
              cerr << "Warning: '" << (path + name) 
                   << "' ignored; not a regular file" << endl;
            }
          }
          }
        }
        }
        else
        else
 Lines 667-673    Link Here 
            if (pw == wildcard.end())
            if (pw == wildcard.end())
            {
            {
              matches->push_back(path + name);
              if (is_regular_file(path + name)) 
              {
                matches->push_back(path + name);
              }
              else
              {
                cerr << "Warning: '" << (path + name) 
                     << "' ignored; not a regular file" << endl;
              }
            }
            }
          }
          }
        }
        }
 Lines 678-689    Link Here 
  }
  }
  else
  else
  {
  {
    struct stat st;
    if (is_regular_file(path + wildcard))
    string fn = path + wildcard;
    if (stat(fn.c_str(), &st) == 0)
    {
    {
      matches->push_back(path + wildcard);
      matches->push_back(path + wildcard);
    }
    }
    else
    {
      cerr << "Warning: '" << (path + wildcard) 
           << "' ignored; not a regular file" << endl;
    }
  }
  }
  return matches;
  return matches;