Check if file actually exists
This commit is contained in:
parent
0abf3a803a
commit
c4adc3b4dc
|
@ -157,11 +157,19 @@ int main(int argc, char **argv) {
|
|||
exit(1);
|
||||
}
|
||||
|
||||
int set{0};
|
||||
|
||||
for (int i{1}; i < ac; i++) {
|
||||
std::ifstream f(av[i]);
|
||||
|
||||
if (static_cast<bool>(f.good())) {
|
||||
set = 1;
|
||||
getMetadataFromFile(format, av[i]);
|
||||
}
|
||||
}
|
||||
|
||||
if (!set) {
|
||||
std::cout << "mcopy: File not found.\n";
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue