aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Tatham <anakin@pobox.com>2017-05-15 21:00:12 +0100
committerSimon Tatham <anakin@pobox.com>2017-05-15 21:00:12 +0100
commit0985b382d387f6868240928db1531b22c0915d24 (patch)
tree0c0377d7266961e78b5a7fc6fc1771d9e39aaaac
parent505ea0fc84017391d0750541d5bf4c418aecad47 (diff)
downloadwix-on-linux-0985b382d387f6868240928db1531b22c0915d24.tar.gz
wix-on-linux-0985b382d387f6868240928db1531b22c0915d24.tar.bz2
wix-on-linux-0985b382d387f6868240928db1531b22c0915d24.zip
Create the cab with the files in the right order.
In my test MSI, the files are supposed to be in alphabetical order, not in 'whatever order lcab enumerated the Unix directory I pointed it at' order. The test MSI didn't install, but with this change, it does, so my guess is that either the real Windows installer system depends on the alphabetical order for a search algorithm, or else files in the cab are referred to by a numeric index of some kind.
-rw-r--r--fake-winterop.c25
1 files changed, 22 insertions, 3 deletions
diff --git a/fake-winterop.c b/fake-winterop.c
index c302f12..eb891c4 100644
--- a/fake-winterop.c
+++ b/fake-winterop.c
@@ -29,6 +29,9 @@ typedef struct CabCreateContext {
29 char *tempdir; 29 char *tempdir;
30 char *outdir; 30 char *outdir;
31 char *outfile; 31 char *outfile;
32
33 char **args;
34 int nargs, argsize;
32} CabCreateContext; 35} CabCreateContext;
33 36
34uint32_t CreateCabBegin(const char16_t *wzCab, const char16_t *wzCabDir, 37uint32_t CreateCabBegin(const char16_t *wzCab, const char16_t *wzCabDir,
@@ -43,6 +46,11 @@ uint32_t CreateCabBegin(const char16_t *wzCab, const char16_t *wzCabDir,
43 ctx->tempdir = dupcat(ctx->outdir, "/cabXXXXXX", (const char *)NULL); 46 ctx->tempdir = dupcat(ctx->outdir, "/cabXXXXXX", (const char *)NULL);
44 if (!mkdtemp(ctx->tempdir)) 47 if (!mkdtemp(ctx->tempdir))
45 err(1, "mkdtemp"); 48 err(1, "mkdtemp");
49 ctx->nargs = 0;
50 ctx->argsize = 16;
51 ctx->args = snewn(ctx->argsize, char *);
52 ctx->args[ctx->nargs++] = dupcat("lcab", (const char *)NULL);
53 ctx->args[ctx->nargs++] = dupcat("-n", (const char *)NULL);
46 *out_ctx = ctx; 54 *out_ctx = ctx;
47 return 0; 55 return 0;
48} 56}
@@ -54,9 +62,15 @@ uint32_t CreateCabAddFile(const char16_t *wzFile, const char16_t *wzToken,
54 char *file_abs = realpath(file, NULL); 62 char *file_abs = realpath(file, NULL);
55 char *cabname = ascii(wzToken, true); 63 char *cabname = ascii(wzToken, true);
56 char *cab_abs = dupcat(ctx->tempdir, "/", cabname, (const char *)NULL); 64 char *cab_abs = dupcat(ctx->tempdir, "/", cabname, (const char *)NULL);
57 printf("CreateCabAddFile: %s <- %s\n", ctx->outfile, file_abs); 65 printf("CreateCabAddFile: %s :: %s <- %s\n", ctx->outfile,
66 cabname, file_abs);
58 if (symlink(file_abs, cab_abs) < 0) 67 if (symlink(file_abs, cab_abs) < 0)
59 err(1, "symlink"); 68 err(1, "symlink");
69 if (ctx->nargs + 1 >= ctx->argsize) {
70 ctx->argsize = ctx->nargs * 5 / 4 + 16;
71 ctx->args = sresize(ctx->args, ctx->argsize, char *);
72 }
73 ctx->args[ctx->nargs++] = cab_abs;
60 return 0; 74 return 0;
61} 75}
62 76
@@ -72,8 +86,13 @@ uint32_t CreateCabAddFiles(const char16_t *const *pwzFiles,
72 86
73uint32_t CreateCabFinish(CabCreateContext *ctx, void (*split_callback)(void)) 87uint32_t CreateCabFinish(CabCreateContext *ctx, void (*split_callback)(void))
74{ 88{
75 system_argv("lcab", "-r", "-n", ctx->tempdir, ctx->outfile, 89 if (ctx->nargs + 2 >= ctx->argsize) {
76 (const char *)NULL); 90 ctx->argsize = ctx->nargs * 5 / 4 + 16;
91 ctx->args = sresize(ctx->args, ctx->argsize, char *);
92 }
93 ctx->args[ctx->nargs++] = ctx->outfile;
94 ctx->args[ctx->nargs++] = NULL;
95 system_argv_array(ctx->args);
77 return 0; 96 return 0;
78} 97}
79 98