Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
__pakfire_path_relative(path, sizeof(path), root, s)
int __pakfire_path_relative(char* buffer, const size_t length, const char* root, const char* s);
+#define pakfire_path_absolute(path, s) \
+ __pakfire_path_absolute(path, sizeof(path), s)
+int __pakfire_path_absolute(char* buffer, const size_t length, const char* s);
+
#endif /* PAKFIRE_PATH_H */
return r;
}
+
+int __pakfire_path_absolute(char* buffer, const size_t length, const char* s) {
+ struct pakfire_path* path = NULL;
+ int r;
+
+ // Parse the path
+ r = pakfire_path_parse(&path, s);
+ if (r)
+ goto ERROR;
+
+ // Make it absolute
+ path->is_absolute = 1;
+
+ // Write back the path
+ r = pakfire_path_to_string(path, buffer, length);
+ if (r)
+ goto ERROR;
+
+ERROR:
+ if (path)
+ pakfire_path_free(path);
+
+ return r;
+}