🐛 fix download icon

This commit is contained in:
Tw93
2023-08-28 18:38:47 +08:00
parent e246bcf12b
commit b5ad835f50

View File

@@ -1,7 +1,6 @@
import shelljs from 'shelljs'; import shelljs from 'shelljs';
import axios from 'axios'; import axios from 'axios';
import fs from 'fs'; import fs from 'fs';
import os from 'os';
import { fileURLToPath } from 'url'; import { fileURLToPath } from 'url';
import path, { dirname } from 'path'; import path, { dirname } from 'path';
@@ -31,19 +30,19 @@ let params = `node cli.js ${process.env.URL} --name ${process.env.NAME}`;
// Download Icons // Download Icons
if (process.env.ICON && process.env.ICON !== '') { if (process.env.ICON && process.env.ICON !== '') {
let iconFile; let iconFile;
switch (os.type()) { switch (process.platform) {
case 'Linux': case 'linux':
iconFile = 'icon.png'; iconFile = 'icon.png';
break; break;
case 'Darwin': case 'darwin':
iconFile = 'icon.icns'; iconFile = 'icon.icns';
break; break;
case 'Windows_NT': case 'win32':
iconFile = 'icon.ico'; iconFile = 'icon.ico';
break; break;
default: default:
console.log("Unable to detect your OS system, won't download the icon!"); console.log("Unable to detect your OS system, won't download the icon!");
return; process.exit(1);
} }
axios axios