Skip to content

Commit 0b61464

Browse files
juuz0kelson42
authored andcommitted
Remove skipInvalid flag
skipInvalid=false makes little sense, if an invalid book is found, we can simply choose to ignore it rather stopping the whole operation midway.
1 parent 18ef626 commit 0b61464

File tree

2 files changed

+1
-8
lines changed

2 files changed

+1
-8
lines changed

include/manager.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,11 +159,9 @@ class Manager
159159
* Add all books from the directory tree into the library.
160160
*
161161
* @param path The path of the directory to scan.
162-
* @param skipInvalid If the function should stop for an invalid file.
163162
* @param verboseFlag Verbose logs flag.
164163
*/
165164
void addBooksFromDirectory(const std::string& path,
166-
const bool skipInvalid = true,
167165
const bool verboseFlag = false);
168166

169167
std::string writableLibraryPath;

src/manager.cpp

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,6 @@ bool Manager::addBookFromPath(const std::string& pathToOpen,
257257
}
258258

259259
void Manager::addBooksFromDirectory(const std::string& path,
260-
const bool skipInvalid,
261260
const bool verboseFlag)
262261
{
263262
std::set<std::string> iteratedDirs;
@@ -285,11 +284,7 @@ void Manager::addBooksFromDirectory(const std::string& path,
285284
std::cout << "Already iterated over " << pathString << ". Skipping..." << std::endl;
286285
} else {
287286
if (!this->addBookFromPath(pathString, pathString, "", false)) {
288-
if (skipInvalid)
289-
std::cerr << "Skipping invalid file: " << pathString << std::endl;
290-
else {
291-
throw std::runtime_error("Unable to add file: " + pathString + " into the library.");
292-
}
287+
std::cerr << "Could not add " << pathString << " into the library." << std::endl;
293288
} else if (verboseFlag) {
294289
std::cout << "Added " << pathString << " into the library." << std::endl;
295290
totalBooksAdded++;

0 commit comments

Comments
 (0)