Lines 618-623
Link Here
|
618 |
return result; |
618 |
return result; |
619 |
} |
619 |
} |
620 |
|
620 |
|
|
|
621 |
bool is_regular_file(const string &p) |
622 |
{ |
623 |
struct stat st; |
624 |
return (stat(p.c_str(), &st) == 0 && S_ISREG(st.st_mode)); |
625 |
} |
626 |
|
621 |
list<string>* DiskFile::FindFiles(string path, string wildcard) |
627 |
list<string>* DiskFile::FindFiles(string path, string wildcard) |
622 |
{ |
628 |
{ |
623 |
list<string> *matches = new list<string>; |
629 |
list<string> *matches = new list<string>; |
Lines 648-654
Link Here
|
648 |
name.substr(0, where) == front && |
654 |
name.substr(0, where) == front && |
649 |
name.substr(name.size()-back.size()) == back) |
655 |
name.substr(name.size()-back.size()) == back) |
650 |
{ |
656 |
{ |
651 |
matches->push_back(path + name); |
657 |
if (is_regular_file(path + name)) |
|
|
658 |
{ |
659 |
matches->push_back(path + name); |
660 |
} |
661 |
else |
662 |
{ |
663 |
cerr << "Warning: '" << (path + name) |
664 |
<< "' ignored; not a regular file" << endl; |
665 |
} |
652 |
} |
666 |
} |
653 |
} |
667 |
} |
654 |
else |
668 |
else |
Lines 667-673
Link Here
|
667 |
|
681 |
|
668 |
if (pw == wildcard.end()) |
682 |
if (pw == wildcard.end()) |
669 |
{ |
683 |
{ |
670 |
matches->push_back(path + name); |
684 |
if (is_regular_file(path + name)) |
|
|
685 |
{ |
686 |
matches->push_back(path + name); |
687 |
} |
688 |
else |
689 |
{ |
690 |
cerr << "Warning: '" << (path + name) |
691 |
<< "' ignored; not a regular file" << endl; |
692 |
} |
671 |
} |
693 |
} |
672 |
} |
694 |
} |
673 |
} |
695 |
} |
Lines 678-689
Link Here
|
678 |
} |
700 |
} |
679 |
else |
701 |
else |
680 |
{ |
702 |
{ |
681 |
struct stat st; |
703 |
if (is_regular_file(path + wildcard)) |
682 |
string fn = path + wildcard; |
|
|
683 |
if (stat(fn.c_str(), &st) == 0) |
684 |
{ |
704 |
{ |
685 |
matches->push_back(path + wildcard); |
705 |
matches->push_back(path + wildcard); |
686 |
} |
706 |
} |
|
|
707 |
else |
708 |
{ |
709 |
cerr << "Warning: '" << (path + wildcard) |
710 |
<< "' ignored; not a regular file" << endl; |
711 |
} |
687 |
} |
712 |
} |
688 |
|
713 |
|
689 |
return matches; |
714 |
return matches; |