Fix win32 os extension guesses
This commit is contained in:
parent
8ce0bc7e71
commit
339c92f6ad
9
index.js
9
index.js
|
@ -23,9 +23,12 @@ zip.listFileContents(FILENAME, (entries) => {
|
|||
let osguess1 = osguess.guessFromFilename(FILENAME);
|
||||
let osguess2 = osguess.guessFromContents(entries);
|
||||
|
||||
if (osguess1 !== osguess2 && osguess1!==null) {
|
||||
if (osguess1 !== osguess2 && osguess1 && osguess2) {
|
||||
console.log(`Unsure about operating system. Going with ${osguess2}. Other option was ${osguess1}`);
|
||||
}
|
||||
if (osguess1 && !osguess2) {
|
||||
osguess2 = osguess1
|
||||
}
|
||||
let arch = osguess.guessArch(FILENAME, entries);
|
||||
let asar = finder.asar(entries);
|
||||
let binary = finder.binary(entries);
|
||||
|
@ -54,8 +57,8 @@ zip.listFileContents(FILENAME, (entries) => {
|
|||
if (versionFiles.length > 0) {
|
||||
versionFiles.map((f) => {
|
||||
zip.readFileContents(FILENAME, f, (c) => {
|
||||
console.log("Found Version file: v" + c);
|
||||
logSupport(`v${c}`)
|
||||
console.log("Found Version file: " + c);
|
||||
logSupport(`${c}`)
|
||||
});
|
||||
});
|
||||
}
|
||||
|
|
10
os.js
10
os.js
|
@ -14,12 +14,10 @@ module.exports = {
|
|||
} else if (fn.match(/win/)) {
|
||||
return 'win32'
|
||||
} else {
|
||||
ext = path.extname(inputFile)
|
||||
if (ext.match(/dmg/)) {
|
||||
return 'darwin'
|
||||
} else if (ext.match('/exe/')) {
|
||||
return 'win32'
|
||||
} else if (ext.match(/deb/) ||ext.match(/appimage/i) || ext.match(/pacman/)) {
|
||||
let ext = path.extname(inputFile).toLowerCase()
|
||||
if (ext == '.dmg') {return 'darwin'}
|
||||
if (ext == '.exe') {return 'win32'}
|
||||
if (['.deb', '.appimage', '.pacman'].indexOf(ext) !== -1) {
|
||||
return 'linux'
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,6 +23,7 @@ test('it should windows correctly from filename', ()=> {
|
|||
assert.deepEqual('win32', os.guessFromFilename('particl-desktop-2.3.6-win-ia32.zip'))
|
||||
assert.deepEqual('win32', os.guessFromFilename('Multrin-1.3.0-ia32-win.zip'))
|
||||
assert.deepEqual('win32', os.guessFromFilename('Multrin-1.3.0-ia32-win.exe'))
|
||||
assert.deepEqual('win32', os.guessFromFilename('Assessment.Disaggregation-1.1.4.Setup.exe'))
|
||||
});
|
||||
|
||||
test('it should guess correctly from file list', ()=> {
|
||||
|
|
Loading…
Reference in New Issue