Skip to content

Commit 0ab4a57

Browse files
committed
updates, change listArchive in order to test on CI, it seems full 7z from for linux and mac os not functional
- full `7z` binary from from sourceforge errors on run for linux - full `7z` binary from rudix-mac does not find 7z.so, errors looking for 7z.dll instead
1 parent 314e701 commit 0ab4a57

File tree

4 files changed

+21
-17
lines changed

4 files changed

+21
-17
lines changed

lib/listArchive.mjs

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -72,25 +72,29 @@ export default function (filepath, options, override = false) {
7272

7373
// Create a string that can be parsed by `run`.
7474
let command = 'l "' + filepath + '" ';
75-
Run('7z', command, options, override)
75+
Run((process.platform == 'win32' ? '7z' : '7za'), command, options, override)
7676
.progress(function (data) {
7777
return progress(onprogress(data));
7878
})
7979
.then(function () {
8080
return resolve(spec);
8181
})
82-
.catch(function () {
83-
console.error('ListArchive failed using `7z`, retying with `7za`.');
84-
Run('7za', command, options, override)
85-
.progress(function (data) {
86-
return progress(onprogress(data));
87-
})
88-
.then(function (args) {
89-
return resolve(args);
90-
})
91-
.catch(function (err) {
92-
return reject(err);
93-
});
82+
.catch(function (err) {
83+
if (process.platform == 'win32') {
84+
console.error('ListArchive failed using `7z`, retying with `7za`.');
85+
Run('7za', command, options, override)
86+
.progress(function (data) {
87+
return progress(onprogress(data));
88+
})
89+
.then(function (args) {
90+
return resolve(args);
91+
})
92+
.catch(function (err) {
93+
return reject(err);
94+
});
95+
} else {
96+
return reject(err);
97+
}
9498
});
9599
});
96100
};

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "node-7z-archive",
3-
"version": "0.9.0",
3+
"version": "0.9.1",
44
"description": "ESM front-end to 7-Zip, featuring alternative full 7z CLI tools, binaries for Linux, Windows, Mac OSX, seamlessly create 7zip SFX self extracting archives targeting different platforms.",
55
"type": "module",
66
"main": "lib/index.mjs",

test/util/run.test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ describe('Utility: `run`', function () {
3636
});
3737

3838
it('should correctly parse complex commands', function (done) {
39-
run('7z', 'a ".tmp/test/archive.7z" "*.exe" "*.dll"', {
39+
run('7za', 'a ".tmp/test/archive.7z" "*.exe" "*.dll"', {
4040
m0: '=BCJ',
4141
m1: '=LZMA:d=21'
4242
})
@@ -54,7 +54,7 @@ describe('Utility: `run`', function () {
5454
});
5555

5656
it('should correctly parse complex commands with spaces', function (done) {
57-
run('7z', 'a ".tmp/Folder A/Folder B\\archive.7z" "*.exe" "*.dll"', {
57+
run('7za', 'a ".tmp/Folder A/Folder B\\archive.7z" "*.exe" "*.dll"', {
5858
m0: '=BCJ',
5959
m1: '=LZMA:d=21',
6060
p: 'My mhjls/\\c $^é5°',

0 commit comments

Comments
 (0)