Skip to content

Commit 3957521

Browse files
committed
Fix incorrect directory name used in tarballs.
1 parent f62437f commit 3957521

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

bin/pack-resources.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,12 +73,11 @@ const filesystem = async (fetch) => ({
7373
if (shareDirectory !== undefined) {
7474
const tarEntries = [];
7575
for (const dirent of await readdir(shareDirectory, { withFileTypes: true, recursive: true })) {
76+
const name = `${dirent.parentPath}/${dirent.name}`.replace(`${shareDirectory}/`, '');
7677
if (dirent.isDirectory()) {
77-
tarEntries.push({name: dirent.name});
78+
tarEntries.push({name: name});
7879
} else if (dirent.isFile()) {
79-
const name = `${dirent.parentPath}/${dirent.name}`.replace(`${shareDirectory}/`, '');
80-
const data = await readFile(`${dirent.parentPath}/${dirent.name}`);
81-
tarEntries.push({name, data});
80+
tarEntries.push({name, data: await readFile(`${dirent.parentPath}/${dirent.name}`)});
8281
} else {
8382
console.error(`Unsupported type of '${dirent.name}'!`);
8483
process.exit(2);

test/yowasp_runtime_test/index.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ if ((await yowaspRuntimeTest.run(['share/foo.txt', 'bar.txt'], {}))['bar.txt'] !
1010
throw 'test 1 failed (1)';
1111
if ((await yowaspRuntimeTest.run(['share/bar/baz.txt', 'bar.txt'], {}))['bar.txt'] !== 'meow\n')
1212
throw 'test 1 failed (2)';
13+
if ((await yowaspRuntimeTest.run(['share/bar/cat/stat.txt', 'bar.txt'], {}))['bar.txt'] !== 'im drumnk\n')
14+
throw 'test 1 failed (3)';
1315

1416
if ((await yowaspRuntimeTest.run(['baz.txt', 'bar.txt'], {'baz.txt': 'contents of baz'}))['bar.txt'] !== 'contents of baz')
1517
throw 'test 2 failed';
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
im drumnk

0 commit comments

Comments
 (0)