]> wimlib.net Git - wimlib/commitdiff
Add wrappers around wimlib_update_image()
authorEric Biggers <ebiggers3@gmail.com>
Tue, 13 May 2014 17:45:45 +0000 (12:45 -0500)
committerEric Biggers <ebiggers3@gmail.com>
Tue, 13 May 2014 18:05:02 +0000 (13:05 -0500)
* wimlib_add_tree()
* wimlib_rename_path()
* wimlib_delete_path()

include/wimlib.h
src/update_image.c

index 037f67d6327b1ec61ab49ccaa4acc321d26df466..5b85631501fc1f9a5755ef8ff5dfe471c8d1451b 100644 (file)
@@ -2107,6 +2107,20 @@ wimlib_add_image_multisource(WIMStruct *wim,
                             int add_flags,
                             wimlib_progress_func_t progress_func);
 
+/**
+ * @ingroup G_modifying_wims
+ *
+ * Add the file or directory tree at @p fs_source_path on the filesystem to the
+ * location @p wim_target_path within the specified @p image of the @p wim.
+ *
+ * This just builds an appropriate ::wimlib_add_command and passes it to
+ * wimlib_update_image().
+ */
+extern int
+wimlib_add_tree(WIMStruct *wim, int image,
+               const wimlib_tchar *fs_source_path,
+               const wimlib_tchar *wim_target_path, int add_flags);
+
 /**
  * @ingroup G_creating_and_opening_wims
  *
@@ -2173,6 +2187,18 @@ wimlib_create_new_wim(int ctype, WIMStruct **wim_ret);
 extern int
 wimlib_delete_image(WIMStruct *wim, int image);
 
+/**
+ * @ingroup G_modifying_wims
+ *
+ * Delete the @p path from the specified @p image of the @p wim.
+ *
+ * This just builds an appropriate ::wimlib_delete_command and passes it to
+ * wimlib_update_image().
+ */
+extern int
+wimlib_delete_path(WIMStruct *wim, int image,
+                  const wimlib_tchar *path, int delete_flags);
+
 /**
  * @ingroup G_modifying_wims
  *
@@ -3351,6 +3377,19 @@ wimlib_reference_template_image(WIMStruct *wim, int new_image,
                                WIMStruct *template_wim, int template_image,
                                int flags, wimlib_progress_func_t progress_func);
 
+/**
+ * @ingroup G_modifying_wims
+ *
+ * Rename the @p source_path to the @p dest_path in the specified @p image of
+ * the @p wim.
+ *
+ * This just builds an appropriate ::wimlib_rename_command and passes it to
+ * wimlib_update_image().
+ */
+extern int
+wimlib_rename_path(WIMStruct *wim, int image,
+                  const wimlib_tchar *source_path, const wimlib_tchar *dest_path);
+
 /**
  * @ingroup G_wim_information
  *
index a88ccd92a5652e6cacba0360492e8d190fbb7f0a..cda3797d53350f36c3cfc84c1155ee591c508847 100644 (file)
@@ -1471,3 +1471,52 @@ out_free_cmds_copy:
 out:
        return ret;
 }
+
+static int
+update1(WIMStruct *wim, int image, const struct wimlib_update_command *cmd)
+{
+       return wimlib_update_image(wim, image, cmd, 1, 0, NULL);
+}
+
+WIMLIBAPI int
+wimlib_delete_path(WIMStruct *wim, int image,
+                  const tchar *path, int delete_flags)
+{
+       struct wimlib_update_command cmd;
+
+       cmd.op = WIMLIB_UPDATE_OP_DELETE;
+       cmd.delete_.wim_path = (tchar *)path;
+       cmd.delete_.delete_flags = delete_flags;
+
+       return update1(wim, image, &cmd);
+}
+
+WIMLIBAPI int
+wimlib_rename_path(WIMStruct *wim, int image,
+                  const tchar *source_path, const tchar *dest_path)
+{
+       struct wimlib_update_command cmd;
+
+       cmd.op = WIMLIB_UPDATE_OP_RENAME;
+       cmd.rename.wim_source_path = (tchar *)source_path;
+       cmd.rename.wim_target_path = (tchar *)dest_path;
+       cmd.rename.rename_flags = 0;
+
+       return update1(wim, image, &cmd);
+}
+
+WIMLIBAPI int
+wimlib_add_tree(WIMStruct *wim, int image,
+               const tchar *fs_source_path, const tchar *wim_target_path,
+               int add_flags)
+{
+       struct wimlib_update_command cmd;
+
+       cmd.op = WIMLIB_UPDATE_OP_ADD;
+       cmd.add.fs_source_path = (tchar *)fs_source_path;
+       cmd.add.wim_target_path = (tchar *)wim_target_path;
+       cmd.add.add_flags = add_flags;
+       cmd.add.config_file = NULL;
+
+       return update1(wim, image, &cmd);
+}