Skip to content

Commit 8724595

Browse files
debug(ci): windows working dir
Signed-off-by: Victor Adossi <vadossi@cosmonic.com>
1 parent 9c93efc commit 8724595

File tree

1 file changed

+13
-7
lines changed

1 file changed

+13
-7
lines changed

src/componentize.js

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { fileURLToPath, URL } from 'node:url';
55
import { cwd, stdout, platform } from 'node:process';
66
import { spawnSync } from 'node:child_process';
77
import { tmpdir } from 'node:os';
8-
import { resolve, join, dirname } from 'node:path';
8+
import { resolve, join, dirname, relative } from 'node:path';
99
import { readFile, writeFile, mkdir, rm, stat } from 'node:fs/promises';
1010
import { rmSync, existsSync } from 'node:fs';
1111
import { createHash } from 'node:crypto';
@@ -23,7 +23,7 @@ import {
2323
stubWasi,
2424
} from '../lib/spidermonkey-embedding-splicer.js';
2525

26-
import { maybeWindowsPath } from './platform.js';
26+
import { maybeWindowsPath, IS_WINDOWS } from './platform.js';
2727

2828
export const { version } = JSON.parse(
2929
await readFile(new URL('../package.json', import.meta.url), 'utf8'),
@@ -94,7 +94,7 @@ export async function componentize(
9494

9595
let {
9696
sourceName = 'source.js',
97-
sourcePath = join(sourcesDir, sourceName),
97+
sourcePath = maybeWindowsPath(join(sourcesDir, sourceName)),
9898
preview2Adapter = preview1AdapterReactorPath(),
9999
witPath,
100100
witWorld,
@@ -131,7 +131,13 @@ export async function componentize(
131131
const outputWasmPath = join(workDir, 'out.wasm');
132132

133133
await writeFile(inputWasmPath, Buffer.from(wasm));
134-
let initializerPath = join(sourcesDir, 'initializer.js');
134+
let initializerPath = maybeWindowsPath(join(sourcesDir, 'initializer.js'));
135+
if (IS_WINDOWS) {
136+
console.log("expected path?", initializerPath);
137+
console.log("exists??", existsSync(initializerPath));
138+
console.log("relpath to current dir??", relative(maybeWindowsPath(cwd()), initializerPath));
139+
console.log("relpath to workdir dir??", relative(workDir, initializerPath));
140+
}
135141
await writeFile(initializerPath, jsBindings);
136142

137143
if (debugBindings) {
@@ -484,15 +490,15 @@ function getEnginePath(opts) {
484490

485491
/** Prepare a work directory for use with componentization */
486492
async function prepWorkDir() {
487-
const baseDir = join(
493+
const baseDir = maybeWindowsPath(join(
488494
tmpdir(),
489495
createHash('sha256')
490496
.update(Math.random().toString())
491497
.digest('hex')
492498
.slice(0, 12),
493-
);
499+
));
494500
await mkdir(baseDir);
495-
const sourcesDir = join(baseDir, 'sources');
501+
const sourcesDir = maybeWindowsPath(join(baseDir, 'sources'));
496502
await mkdir(sourcesDir);
497503
return { baseDir, sourcesDir };
498504
}

0 commit comments

Comments
 (0)