PKGBUILDs/aur/par2cmdline/05-When-a-file-is-specified-to-be-scanned-but-it-dooen-.patch
2011-06-09 17:56:14 -04:00

59 lines
1.9 KiB
Diff

--- a/commandline.cpp
+++ b/commandline.cpp
@@ -642,30 +642,34 @@ bool CommandLine::Parse(int argc, char *argv[])
}
else
{
- // All other files must exist
+ // Originally, all specified files were supposed to exist, or the program
+ // would stop with an error message. This was not practical, for example in
+ // a directory with files appearing and disappearing (an active download directory).
+ // So the new rule is: when a specified file doesn't exist, it is silently skipped.
if (!DiskFile::FileExists(filename))
{
- cerr << "The source file does not exist: " << filename << endl;
- return false;
- }
-
- u64 filesize = DiskFile::GetFileSize(filename);
-
- // Ignore all 0 byte files
- if (filesize > 0)
- {
- extrafiles.push_back(ExtraFile(filename, filesize));
-
- // track the total size of the source files and how
- // big the largest one is.
- totalsourcesize += filesize;
- if (largestsourcesize < filesize)
- largestsourcesize = filesize;
- }
- else
- {
- cout << "Skipping 0 byte file: " << filename << endl;
- }
+ cout << "Ignoring non-existent source file: " << filename << endl;
+ }
+ else
+ {
+ u64 filesize = DiskFile::GetFileSize(filename);
+
+ // Ignore all 0 byte files
+ if (filesize > 0)
+ {
+ extrafiles.push_back(ExtraFile(filename, filesize));
+
+ // track the total size of the source files and how
+ // big the largest one is.
+ totalsourcesize += filesize;
+ if (largestsourcesize < filesize)
+ largestsourcesize = filesize;
+ }
+ else
+ {
+ cout << "Skipping 0 byte file: " << filename << endl;
+ }
+ } //end file exists
}
++fn;