Skip to content

Commit

Permalink
Fix: Terminate Skyscraper when no input files or no cache.
Browse files Browse the repository at this point in the history
settings.h: dead code removal
  • Loading branch information
Gemba committed Nov 26, 2024
1 parent 1c10b0c commit f67ca9b
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 17 deletions.
4 changes: 0 additions & 4 deletions src/settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,6 @@ struct Settings {
bool threadsSet = false;
int minMatch = 65;
bool minMatchSet = false;
int notFound = 0;
int found = 0;
int currentFile = 0;
int totalFiles = 0;
int maxLength = 2500;
bool brackets = true;
bool refresh = false;
Expand Down
30 changes: 17 additions & 13 deletions src/skyscraper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,18 @@ void Skyscraper::run() {
}

totalFiles = queue->length();
if (totalFiles == 0) {
QString extraInfo = doCacheScraping ? "in cache "
: "matching these extensions " +
platformFileExtensions();
printf("\nNo files to process %s for platform "
"'%s'.\nCheck configured and existing file extensions and cache "
"content.\n\n\033[1;33mSkyscraper came to an untimely "
"end.\033[0m\n\n",
extraInfo.toStdString().c_str(),
config.platform.toStdString().c_str());
exit(0);
}

if (config.romLimit != -1 && totalFiles > config.romLimit) {
int inCache = 0;
Expand Down Expand Up @@ -395,20 +407,12 @@ void Skyscraper::run() {
}
printf("\n");
if (!doCacheScraping) {
if (totalFiles > 0) {
printf(
"Starting scraping run on \033[1;32m%d\033[0m files using "
"\033[1;32m%d\033[0m threads.\nSit back, relax and let me do "
"the work! :)\n\n",
totalFiles, config.threads);
} else {
printf("\nNo entries to scrape...\n\n");
}
} else {
if (totalFiles == 0) {
printf("\nAll games found in cache.\n\n");
}
printf("Starting scraping run on \033[1;32m%d\033[0m files using "
"\033[1;32m%d\033[0m threads.\nSit back, relax and let me do "
"the work! :)\n",
totalFiles, config.threads);
}
printf("\n");

timer.start();
currentFile = 1;
Expand Down

0 comments on commit f67ca9b

Please sign in to comment.