]> wimlib.net Git - wimlib/blobdiff - src/extract.c
Add support for WIMLIB_EXTRACT_FLAG_SYMLINK on Windows
[wimlib] / src / extract.c
index 2cc134dc7b10757aeab6841045400da2354588cc..7ca0122054590eacb26dd32955431c9485597612 100644 (file)
@@ -898,6 +898,11 @@ static unsigned
 get_num_path_components(const tchar *path, tchar path_separator)
 {
        unsigned num_components = 0;
+#ifdef __WIN32__
+       /* Ignore drive letter.  */
+       if (path[0] != L'\0' && path[1] == L':')
+               path += 2;
+#endif
 
        while (*path) {
                while (*path == path_separator)
@@ -940,7 +945,11 @@ extract_multiimage_symlink(const tchar *oldpath, const tchar *newpath,
                num_target_path_components--;
        }
 
-       p_old = oldpath;
+       p_old = oldpath + ctx->ops->path_prefix_nchars;
+#ifdef __WIN32__
+       if (p_old[0] != L'\0' && p_old[1] == ':')
+               p_old += 2;
+#endif
        while (*p_old == ctx->ops->path_separator)
                p_old++;
        while (--num_target_path_components) {