]> wimlib.net Git - wimlib/blobdiff - src/add_image.c
imagex-extract initial implementation
[wimlib] / src / add_image.c
index ff97bc1c603a7ee1ec7a4b5bad82a13eccaf6062..c39ded67c3903ec1ba1b8458a504fd0ae07665eb 100644 (file)
@@ -210,9 +210,9 @@ unix_capture_symlink(struct wim_dentry **root_p,
                if ((params->add_image_flags & WIMLIB_ADD_IMAGE_FLAG_RPFIX) &&
                     dest[0] == '/')
                {
-                       dest = fixup_symlink(dest,
-                                            params->capture_root_ino,
-                                            params->capture_root_dev);
+                       dest = capture_fixup_absolute_symlink(dest,
+                                                             params->capture_root_ino,
+                                                             params->capture_root_dev);
                        if (!dest) {
                                WARNING("Ignoring out of tree absolute symlink "
                                        "\"%s\" -> \"%s\"\n"
@@ -225,8 +225,7 @@ unix_capture_symlink(struct wim_dentry **root_p,
                        }
                        inode->i_not_rpfixed = 0;
                }
-               ret = inode_set_symlink(inode, dest,
-                                       params->lookup_table, NULL);
+               ret = wim_inode_set_symlink(inode, dest, params->lookup_table);
                if (ret == 0) {
                        /* Unfortunately, Windows seems to have the concept of
                         * "file" symbolic links as being different from
@@ -479,29 +478,6 @@ exclude_path(const tchar *path, size_t path_len,
 
 }
 
-/* Strip leading and trailing forward slashes from a string.  Modifies it in
- * place and returns the stripped string. */
-static const tchar *
-canonicalize_target_path(tchar *target_path)
-{
-       tchar *p;
-       if (target_path == NULL)
-               return T("");
-       for (;;) {
-               if (*target_path == T('\0'))
-                       return target_path;
-               else if (*target_path == T('/'))
-                       target_path++;
-               else
-                       break;
-       }
-
-       p = tstrchr(target_path, T('\0')) - 1;
-       while (*p == T('/'))
-               *p-- = T('\0');
-       return target_path;
-}
-
 /* Strip leading and trailing slashes from the target paths, and translate all
  * backslashes in the source and target paths into forward slashes. */
 static void
@@ -516,12 +492,8 @@ canonicalize_sources_and_targets(struct wimlib_capture_source *sources,
                /* The Windows API can handle forward slashes.  Just get rid of
                 * backslashes to avoid confusing other parts of the library
                 * code. */
-               zap_backslashes(sources->fs_source_path);
-               if (sources->wim_target_path)
-                       zap_backslashes(sources->wim_target_path);
-
-               sources->wim_target_path =
-                       (tchar*)canonicalize_target_path(sources->wim_target_path);
+               sources->fs_source_path = canonicalize_fs_path(sources->fs_source_path);
+               sources->wim_target_path = canonicalize_wim_path(sources->wim_target_path);
                DEBUG("Canonical target: \"%"TS"\"", sources->wim_target_path);
                sources++;
        }