]> git.ipfire.org Git - pakfire.git/blobdiff - src/libpakfire/pakfire.c
libpakfire: Add function to check if file exists/is readable/is writable in cache
[pakfire.git] / src / libpakfire / pakfire.c
index dcdc9006dd50cd82970ecde70f444c8da16934de..00948d8eb39dbbd5e2074787e79d014bf5d9d240 100644 (file)
@@ -361,6 +361,15 @@ PAKFIRE_EXPORT int pakfire_cache_stat(Pakfire pakfire, const char* path, struct
        return r;
 }
 
+PAKFIRE_EXPORT int pakfire_cache_access(Pakfire pakfire, const char* path, int mode) {
+       char* cache_path = pakfire_get_cache_path(pakfire, path);
+
+       int r = pakfire_access(cache_path, NULL, mode);
+       pakfire_free(cache_path);
+
+       return r;
+}
+
 PAKFIRE_EXPORT time_t pakfire_cache_age(Pakfire pakfire, const char* path) {
        struct stat buffer;