@@ -8,7 +8,6 @@ import { execSync, spawn } from "child_process";
88import fs from "fs" ;
99import path from "path" ;
1010import os from "os" ;
11- import https from "https" ;
1211import { fileURLToPath } from "url" ;
1312import { confirm , welcome } from "./ui.js" ;
1413import { name__ , repo , site } from "../../lib/meta.js" ;
3029const __filename = fileURLToPath ( import . meta. url ) ;
3130const __dirname = path . dirname ( __filename ) ;
3231
33- const ICON_URL = "https://jssc.js.org/favicon.ico" ;
3432const APP_NAME = "JSSC" ;
3533const EXT = ".jssc" ;
3634
@@ -49,6 +47,7 @@ const pkgRoot = path.resolve(__dirname, "../../");
4947const cliPath = path . resolve ( localBin , "./cli.js" ) ;
5048const cfgPath = path . resolve ( localBin , "./windows/default.justc" ) ;
5149const vbsPath = path . resolve ( localBin , "./windows/jssc.vbs" ) ;
50+ const icoPath = path . resolve ( localBin , "./windows/icon.ico" ) ;
5251const nodePath = process . execPath ;
5352
5453const ui = path . resolve ( __dirname , "./ui" ) ;
@@ -58,28 +57,6 @@ function run(cmd) {
5857 execSync ( cmd , { stdio : "inherit" } ) ;
5958}
6059
61- function downloadIcon ( ) {
62- return new Promise ( ( resolve , reject ) => {
63- if ( ! fs . existsSync ( installDir ) ) {
64- fs . mkdirSync ( installDir , { recursive : true } ) ;
65- }
66-
67- const file = fs . createWriteStream ( iconPath ) ;
68-
69- https . get ( ICON_URL , res => {
70- if ( res . statusCode !== 200 ) {
71- reject ( new Error ( "Failed to download icon" ) ) ;
72- return ;
73- }
74-
75- res . pipe ( file ) ;
76- file . on ( "finish" , ( ) => {
77- file . close ( resolve ) ;
78- } ) ;
79- } ) . on ( "error" , reject ) ;
80- } ) ;
81- }
82-
8360function showProgress ( ) {
8461 return spawn ( "powershell" , [
8562 "-NoProfile" ,
@@ -93,12 +70,6 @@ function showProgress() {
9370async function setup ( ) {
9471 const progressUI = showProgress ( ) ;
9572
96- try {
97- await downloadIcon ( ) ;
98- } catch ( err ) {
99- throw new Error ( 'Failed to download icon:' , err . message , '\n' + err . trace ) ;
100- }
101-
10273 let e = [ false , undefined ] ;
10374 try {
10475 fs . mkdirSync ( localPkg , {
@@ -109,9 +80,8 @@ async function setup() {
10980 force : true
11081 } ) ;
11182 fs . copyFileSync ( cfgPath , localCfg ) ;
112- fs . rmSync ( cfgPath ) ;
11383 fs . copyFileSync ( vbsPath , localVbs ) ;
114- fs . rmSync ( vbsPath ) ;
84+ fs . copyFileSync ( icoPath , iconPath ) ;
11585
11686 const vbs = `wscript.exe \\"${ localVbs } \\" \\"${ nodePath } \\" \\"${ cliPath } \\"` ;
11787
0 commit comments