Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Terminate Skyscraper when no input files or no cache. #97

Merged
merged 1 commit into from
Nov 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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