]> wimlib.net Git - wimlib/blobdiff - src/xml.c
Add wimlib_get_image_property() and wimlib_set_image_property()
[wimlib] / src / xml.c
index 60643756ac7f1dde86c559bb20ee2af5455f3585..fdc3ed2ff07259a0d98eef3a61d32de97f92a6c0 100644 (file)
--- a/src/xml.c
+++ b/src/xml.c
@@ -1380,6 +1380,20 @@ wimlib_get_image_description(const WIMStruct *wim, int image)
        return get_image_property(wim, image, "DESCRIPTION", NULL);
 }
 
+WIMLIBAPI const tchar *
+wimlib_get_image_property(const WIMStruct *wim, int image,
+                         const tchar *property_name)
+{
+       const xmlChar *name;
+       const tchar *value;
+
+       if (tstr_get_utf8(property_name, &name))
+               return NULL;
+       value = get_image_property(wim, image, name, NULL);
+       tstr_put_utf8(name);
+       return value;
+}
+
 WIMLIBAPI int
 wimlib_set_image_name(WIMStruct *wim, int image, const tchar *name)
 {
@@ -1400,3 +1414,18 @@ wimlib_set_image_flags(WIMStruct *wim, int image, const tchar *flags)
 {
        return set_image_property(wim, image, "FLAGS", flags);
 }
+
+WIMLIBAPI int
+wimlib_set_image_property(WIMStruct *wim, int image, const tchar *property_name,
+                         const tchar *property_value)
+{
+       const xmlChar *name;
+       int ret;
+
+       ret = tstr_get_utf8(property_name, &name);
+       if (ret)
+               return ret;
+       ret = set_image_property(wim, image, name, property_value);
+       tstr_put_utf8(name);
+       return ret;
+}