mirror of
https://github.com/Llewellynvdm/nativefier.git
synced 2025-02-10 06:58:31 +00:00
Hopefully fix icon retrieval bugs
Icon ext from page-icon contains `.` before ext now, e.g. `.png`
This commit is contained in:
parent
9dc47704ab
commit
a8072d2234
@ -46,7 +46,7 @@
|
||||
"hasbin": "^1.2.0",
|
||||
"lodash": "^4.0.0",
|
||||
"ncp": "^2.0.0",
|
||||
"page-icon": "^0.2.0",
|
||||
"page-icon": "^0.3.0",
|
||||
"progress": "^1.1.8",
|
||||
"request": "^2.67.0",
|
||||
"sanitize-filename": "^1.5.3",
|
||||
|
@ -53,7 +53,7 @@ function allowedIconFormats(platform) {
|
||||
formats.push('.png');
|
||||
break;
|
||||
case 'win32':
|
||||
formats.push('ico');
|
||||
formats.push('.ico');
|
||||
break;
|
||||
default:
|
||||
throw `function allowedIconFormats error: Unknown platform ${platform}`;
|
||||
@ -77,7 +77,7 @@ function allowedIconFormats(platform) {
|
||||
formats.push('.ico');
|
||||
}
|
||||
if (icnsToPng) {
|
||||
formats.push('icns');
|
||||
formats.push('.icns');
|
||||
}
|
||||
break;
|
||||
case 'win32':
|
||||
@ -86,7 +86,7 @@ function allowedIconFormats(platform) {
|
||||
formats.push('.png');
|
||||
}
|
||||
if (icnsToIco) {
|
||||
formats.push('icns');
|
||||
formats.push('.icns');
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
@ -55,9 +55,9 @@ function writeFilePromise(outPath, data) {
|
||||
}
|
||||
|
||||
function inferFromPage(targetUrl, platform, outDir) {
|
||||
let preferredExt = 'png';
|
||||
let preferredExt = '.png';
|
||||
if (platform === 'win32') {
|
||||
preferredExt = 'ico';
|
||||
preferredExt = '.ico';
|
||||
}
|
||||
|
||||
// todo might want to pass list of preferences instead
|
||||
@ -67,8 +67,7 @@ function inferFromPage(targetUrl, platform, outDir) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// note that ext from page icon does not contain a '.'
|
||||
const outfilePath = path.join(outDir, `/icon.${icon.ext}`);
|
||||
const outfilePath = path.join(outDir, `/icon${icon.ext}`);
|
||||
return writeFilePromise(outfilePath, icon.data);
|
||||
});
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user