mirror of
https://github.com/Llewellynvdm/nativefier.git
synced 2025-02-14 00:30:29 +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",
|
"hasbin": "^1.2.0",
|
||||||
"lodash": "^4.0.0",
|
"lodash": "^4.0.0",
|
||||||
"ncp": "^2.0.0",
|
"ncp": "^2.0.0",
|
||||||
"page-icon": "^0.2.0",
|
"page-icon": "^0.3.0",
|
||||||
"progress": "^1.1.8",
|
"progress": "^1.1.8",
|
||||||
"request": "^2.67.0",
|
"request": "^2.67.0",
|
||||||
"sanitize-filename": "^1.5.3",
|
"sanitize-filename": "^1.5.3",
|
||||||
|
@ -53,7 +53,7 @@ function allowedIconFormats(platform) {
|
|||||||
formats.push('.png');
|
formats.push('.png');
|
||||||
break;
|
break;
|
||||||
case 'win32':
|
case 'win32':
|
||||||
formats.push('ico');
|
formats.push('.ico');
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
throw `function allowedIconFormats error: Unknown platform ${platform}`;
|
throw `function allowedIconFormats error: Unknown platform ${platform}`;
|
||||||
@ -77,7 +77,7 @@ function allowedIconFormats(platform) {
|
|||||||
formats.push('.ico');
|
formats.push('.ico');
|
||||||
}
|
}
|
||||||
if (icnsToPng) {
|
if (icnsToPng) {
|
||||||
formats.push('icns');
|
formats.push('.icns');
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'win32':
|
case 'win32':
|
||||||
@ -86,7 +86,7 @@ function allowedIconFormats(platform) {
|
|||||||
formats.push('.png');
|
formats.push('.png');
|
||||||
}
|
}
|
||||||
if (icnsToIco) {
|
if (icnsToIco) {
|
||||||
formats.push('icns');
|
formats.push('.icns');
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -55,9 +55,9 @@ function writeFilePromise(outPath, data) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function inferFromPage(targetUrl, platform, outDir) {
|
function inferFromPage(targetUrl, platform, outDir) {
|
||||||
let preferredExt = 'png';
|
let preferredExt = '.png';
|
||||||
if (platform === 'win32') {
|
if (platform === 'win32') {
|
||||||
preferredExt = 'ico';
|
preferredExt = '.ico';
|
||||||
}
|
}
|
||||||
|
|
||||||
// todo might want to pass list of preferences instead
|
// todo might want to pass list of preferences instead
|
||||||
@ -67,8 +67,7 @@ function inferFromPage(targetUrl, platform, outDir) {
|
|||||||
return null;
|
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);
|
return writeFilePromise(outfilePath, icon.data);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user