@@ -82,10 +82,16 @@ logger.transports.console.level = "silly";
8282///////////////////////////////
8383autoUpdater . logger = logger ;
8484
85-
85+ //logger.warn("AAAAAAAAAAAAAAAAAAAAAAAAAA FIRST WARN AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAa");
8686const isSecondInstance = app . makeSingleInstance ( ( commandLine , workingDirectory ) => {
8787 // Someone tried to run a second instance, we should focus our window
8888 logger . info ( "Testing for second instance..." ) ;
89+ /*
90+ logger.info("################## SECOND INSTANCE DATA ¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤");
91+ logger.info("process.platform = " + process.platform);
92+ logger.info("process.argv = " + process.argv);
93+ logger.info("commandLine = " + commandLine);
94+ */
8995 //logger.debug(ipcMain.send("asdasd",""));
9096 if ( mainWindow !== null ) {
9197 logger . info ( "Main maindow was not null! Restoring and focusing..." ) ;
@@ -101,13 +107,14 @@ const isSecondInstance = app.makeSingleInstance((commandLine, workingDirectory)
101107 //
102108 // otherwise, you need to listen event in MacOS 'open-file' with event.preventDefault()
103109 // in windows parse process.argv
110+ //logger.error("AAAAAAAAAAAAAAAAAAAAAAAAAAA THIRD ERROR AAAAAAAAAAAAAAAAAAAAAAAAAAa");
104111 logger . info ( "Testing if we need to open a new project..." ) ;
105- if ( process . platform == 'win32' && process . argv . length >= 2 ) {
106- var openFilePath = process . argv [ 1 ] ;
112+ if ( process . platform == 'win32' && commandLine . length >= 2 ) {
113+ var openFilePath = commandLine [ 1 ] ;
107114 if ( current_project !== null ) {
108115 // there is a project open
109116 logger . warn ( "Tried to open new project, while old one still exits!" ) ;
110- logger . info ( "# Old: " + current_projet ) ;
117+ logger . info ( "# Old: " + current_project ) ;
111118 logger . info ( "# New: " + openFilePath ) ;
112119 // create dialog and notify to exit current project before opening new projects...
113120 var options = {
@@ -117,7 +124,7 @@ const isSecondInstance = app.makeSingleInstance((commandLine, workingDirectory)
117124 detail : "Please close the current project, and try opening again." ,
118125 buttons : [ i18n_app . __ ( 'conf-ok' , true ) ]
119126 } ;
120- dialog . showMessageBox ( options , function ( index ) {
127+ dialog . showMessageBox ( mainWindow , options , function ( index ) {
121128 // no need to deal with anything.... just notifying user
122129 if ( index === 1 ) {
123130 //
@@ -136,26 +143,40 @@ const isSecondInstance = app.makeSingleInstance((commandLine, workingDirectory)
136143 logger . warn ( "Platform is not win32, or argv.length is not >=2!" ) ;
137144 }
138145 } else {
146+ //logger.error("AAAAAAAAAAAAAAAAAAAAAAAAAAA FOURTH ERROR AAAAAAAAAAAAAAAAAAAAAAAAAAa");
139147 // no mainwindow! if we are opening project, we are settings this variable just in case
140148 logger . info ( "No main window exists! Setting variable just in case..." ) ;
141- if ( process . platform == 'win32' && process . argv . length >= 2 ) {
142- pre_project = process . argv [ 1 ] ;
143- logger . info ( "Settings main process pre_project variable(win32): " + pre_project ) ;
149+ if ( process . platform == 'win32' && commandLine . length >= 2 ) {
150+ pre_project = commandLine [ 1 ] ;
151+ logger . info ( "[SECOND INSTANCE] Settings main process pre_project variable(win32): " + pre_project ) ;
144152 } else {
145- logger . warn ( "Platform is not win32, or argv.length is not >=2!" ) ;
153+ logger . warn ( "[SECOND INSTANCE] Platform is not win32, or argv.length is not >=2!" ) ;
146154 }
155+ /*
147156 if (process.platform == 'darwin') {
148157 logger.info("Platform was 'darwin'! Opening new mainWindow...");
149158 createMainWindow();
150159 }
160+ */
151161 }
152162} ) ;
153163
154164if ( isSecondInstance ) {
155- logger . debug ( "Tried to create second instance!" ) ;
165+ logger . info ( "Tried to create second instance!" ) ;
156166 app . quit ( )
157167} else {
158- logger . debug ( "This instance is first one!" ) ;
168+ logger . info ( "This instance is first one!" ) ;
169+ /*
170+ logger.info("###################### FIRST INSTANCE DATA %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%");
171+ logger.info("process.platform = " + process.platform);
172+ logger.info("process.argv = " + process.argv);
173+ */
174+ if ( process . platform == 'win32' && process . argv . length >= 2 ) {
175+ pre_project = process . argv [ 1 ] ;
176+ logger . info ( "[FIRST INSTANCE] Settings main process pre_project variable(win32): " + pre_project ) ;
177+ } else {
178+ logger . warn ( "[FIRST INSTANCE] Platform is not win32, or argv.length is not >=2!" ) ;
179+ }
159180}
160181
161182/* Handle opening files in program (while not open before; that is above in the makeSingleInstance callback) */
0 commit comments