int pakfire_filelist_scan(struct pakfire_filelist* list, const char* root,
const char** includes, const char** excludes, int flags) {
+ struct archive* reader = NULL;
struct pakfire_file* file = NULL;
struct archive_entry* entry = NULL;
struct pakfire_filelist_matches matches = {
DEBUG(list->pakfire, " %s\n", *exclude);
}
+ // Check if the path exists
+ if (!pakfire_path_exists(root)) {
+ DEBUG(list->pakfire, "Path to scan (%s) does not exist\n", root);
+ r = 0;
+ goto ERROR;
+ }
+
// Create a new disk reader
- struct archive* reader = pakfire_make_archive_disk_reader(list->pakfire, 1);
+ reader = pakfire_make_archive_disk_reader(list->pakfire, 1);
if (!reader)
goto ERROR;
}
ERROR:
- archive_read_free(reader);
+ if (reader)
+ archive_read_free(reader);
return r;
}
// Scan
-enum pakfire_repo_scan_flags {
- PAKFIRE_REPO_SCAN_IGNORE_NOENT = (1 << 0),
-};
-
int pakfire_repo_scan(struct pakfire_repo* repo, int flags);
// Refresh
DEBUG(repo->pakfire, "No metadata available on local repository."
" Falling back to scan...\n");
- return pakfire_repo_scan(repo, PAKFIRE_REPO_SCAN_IGNORE_NOENT);
+ return pakfire_repo_scan(repo, 0);
}
break;
}
return 1;
}
- // Check if path exists
- if (!pakfire_path_exists(path)) {
- if (flags & PAKFIRE_REPO_SCAN_IGNORE_NOENT)
- return 0;
- }
-
// Create a new filelist
r = pakfire_filelist_create(&filelist, repo->pakfire);
if (r)