@@ -115,17 +115,10 @@ function isSplashScreenEnabled() {
115115
116116function startSplashScreen ( ) {
117117 let imageFile = path . join ( currentBinPath , manifestJsonFile . splashscreen . imageFile ) ;
118- imageSize ( imageFile , ( error , dimensions ) => {
119- if ( error ) {
120- console . log ( `load splashscreen error:` ) ;
121- console . error ( error ) ;
122-
123- throw new Error ( error . message ) ;
124- }
125-
118+ const startWindow = ( width , height ) => {
126119 splashScreen = new BrowserWindow ( {
127- width : dimensions . width ,
128- height : dimensions . height ,
120+ width : width ,
121+ height : height ,
129122 transparent : true ,
130123 center : true ,
131124 frame : false ,
@@ -143,10 +136,25 @@ function startSplashScreen() {
143136
144137 const loadSplashscreenUrl = path . join ( __dirname , 'splashscreen' , 'index.html' ) + '?imgPath=' + imageFile ;
145138 splashScreen . loadURL ( 'file://' + loadSplashscreenUrl ) ;
146-
147139 splashScreen . once ( 'closed' , ( ) => {
148140 splashScreen = null ;
149141 } ) ;
142+ }
143+
144+ if ( manifestJsonFile . splashscreen . width && manifestJsonFile . splashscreen . height ) {
145+ startWindow ( manifestJsonFile . splashscreen . width , manifestJsonFile . splashscreen . height ) ;
146+ return ;
147+ }
148+
149+ imageSize ( imageFile , ( error , dimensions ) => {
150+ if ( error ) {
151+ console . log ( `load splashscreen error:` ) ;
152+ console . error ( error ) ;
153+
154+ throw new Error ( error . message ) ;
155+ }
156+
157+ startWindow ( dimensions . width , dimensions . height )
150158 } ) ;
151159}
152160
0 commit comments