return 0;
}
-static char* pakfire_repo_get_path(PakfireRepo repo) {
- const char* baseurl = pakfire_repo_get_baseurl(repo);
- if (!baseurl)
- return NULL;
+static int pakfire_repo_is_local(PakfireRepo repo) {
+ if (!*repo->appdata->baseurl)
+ return 0;
+
+ return pakfire_string_startswith(repo->appdata->baseurl, "file://");
+}
- // Must be a local repository
- if (!pakfire_string_startswith(baseurl, "file://"))
+static const char* pakfire_repo_get_path(PakfireRepo repo) {
+ if (!pakfire_repo_is_local(repo))
return NULL;
- return strdup(baseurl + strlen("file://"));
+ return repo->appdata->baseurl + strlen("file://");
}
PAKFIRE_EXPORT const char* pakfire_repo_get_keyfile(PakfireRepo repo) {
PAKFIRE_EXPORT int pakfire_repo_scan(PakfireRepo repo, int flags) {
struct pakfire_progressbar* progressbar = NULL;
- char* path = pakfire_repo_get_path(repo);
+ const char* path = pakfire_repo_get_path(repo);
if (!path) {
errno = EINVAL;
return 1;