]> git.ipfire.org Git - pakfire.git/commitdiff
pakfire: Add a function to convert paths to relative
authorMichael Tremer <michael.tremer@ipfire.org>
Wed, 17 Aug 2022 21:32:50 +0000 (21:32 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Wed, 17 Aug 2022 21:32:50 +0000 (21:32 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/libpakfire/include/pakfire/pakfire.h
src/libpakfire/pakfire.c

index b72f3aef1070843e2da9a26370314529f00654a0..630ca10002e1ec5fb96b547d27594371c1dbd7a4 100644 (file)
@@ -164,6 +164,8 @@ const char* pakfire_get_keystore_path(struct pakfire* pakfire);
        __pakfire_make_path(pakfire, dst, sizeof(dst) - 1, path)
 int __pakfire_make_path(struct pakfire* pakfire, char* dst, size_t length, const char* path);
 
+const char* pakfire_relpath(struct pakfire* pakfire, const char* path);
+
 #define pakfire_make_cache_path(pakfire, path, format, ...) \
        __pakfire_make_cache_path(pakfire, path, sizeof(path) - 1, format, __VA_ARGS__)
 
index 7c95c07c445540d51b126d043465ebbf029f2608..a4a61ff9cc5bcd009306d006fe066de070c5a001 100644 (file)
@@ -952,6 +952,10 @@ int __pakfire_make_path(struct pakfire* pakfire, char* dst, size_t length, const
        return __pakfire_path_join(dst, length, pakfire->path, path);
 }
 
+const char* pakfire_relpath(struct pakfire* pakfire, const char* path) {
+       return pakfire_path_relpath(pakfire->path, path);
+}
+
 gpgme_ctx_t pakfire_get_gpgctx(struct pakfire* pakfire) {
        return pakfire->gpgctx;
 }