@@ -227,6 +227,11 @@ bool CmdLineParser::fillSettingsFromArgs(int argc, const char* const argv[])
227227 std::copy_if (fileSettings.cbegin (), fileSettings.cend (), std::back_inserter (mFileSettings ), [&](const FileSettings &fs) {
228228 return mSettings .library .markupFile (fs.filename ) && mSettings .library .processMarkupAfterCode (fs.filename );
229229 });
230+
231+ if (mFileSettings .empty ()) {
232+ mLogger .printError (" could not find or open any of the paths given." );
233+ return false ;
234+ }
230235 }
231236
232237 if (!pathnamesRef.empty ()) {
@@ -239,6 +244,7 @@ bool CmdLineParser::fillSettingsFromArgs(int argc, const char* const argv[])
239244 const bool caseSensitive = true ;
240245#endif
241246 // Execute recursiveAddFiles() to each given file parameter
247+ // TODO: verbose log which files were ignored?
242248 const PathMatch matcher (ignored, caseSensitive);
243249 for (const std::string &pathname : pathnamesRef) {
244250 const std::string err = FileLister::recursiveAddFiles (filesResolved, Path::toNativeSeparators (pathname), mSettings .library .markupExtensions (), matcher);
@@ -248,6 +254,14 @@ bool CmdLineParser::fillSettingsFromArgs(int argc, const char* const argv[])
248254 }
249255 }
250256
257+ if (filesResolved.empty ()) {
258+ mLogger .printError (" could not find or open any of the paths given." );
259+ // TODO: PathMatch should provide the information if files were ignored
260+ if (!ignored.empty ())
261+ mLogger .printMessage (" Maybe all paths were ignored?" );
262+ return false ;
263+ }
264+
251265 // de-duplicate files
252266 {
253267 auto it = filesResolved.begin ();
@@ -283,13 +297,11 @@ bool CmdLineParser::fillSettingsFromArgs(int argc, const char* const argv[])
283297 std::copy_if (files.cbegin (), files.cend (), std::inserter (mFiles , mFiles .end ()), [&](const decltype (files)::value_type& entry) {
284298 return mSettings .library .markupFile (entry.first ) && mSettings .library .processMarkupAfterCode (entry.first );
285299 });
286- }
287300
288- if (mFiles .empty () && mFileSettings .empty ()) {
289- mLogger .printError (" could not find or open any of the paths given." );
290- if (!ignored.empty ())
291- mLogger .printMessage (" Maybe all paths were ignored?" );
292- return false ;
301+ if (mFiles .empty ()) {
302+ mLogger .printError (" could not find or open any of the paths given." );
303+ return false ;
304+ }
293305 }
294306
295307 return true ;
0 commit comments