@@ -115,17 +115,10 @@ function isSplashScreenEnabled() {
115
115
116
116
function startSplashScreen ( ) {
117
117
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 ) => {
126
119
splashScreen = new BrowserWindow ( {
127
- width : dimensions . width ,
128
- height : dimensions . height ,
120
+ width : width ,
121
+ height : height ,
129
122
transparent : true ,
130
123
center : true ,
131
124
frame : false ,
@@ -143,10 +136,25 @@ function startSplashScreen() {
143
136
144
137
const loadSplashscreenUrl = path . join ( __dirname , 'splashscreen' , 'index.html' ) + '?imgPath=' + imageFile ;
145
138
splashScreen . loadURL ( 'file://' + loadSplashscreenUrl ) ;
146
-
147
139
splashScreen . once ( 'closed' , ( ) => {
148
140
splashScreen = null ;
149
141
} ) ;
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 )
150
158
} ) ;
151
159
}
152
160
0 commit comments