@@ -301,9 +301,13 @@ function parseAddonsAndUpdateSelect(arg) {
301301 //path = require('path').resolve(__dirname, defaultOfPath + "/addons");
302302 addons = getDirectories ( arg + "/addons" , "ofx" ) ;
303303
304- addons = addons . filter ( function ( addon ) {
305- return addonsToSkip . indexOf ( addon ) == - 1 ;
306- } ) ;
304+ if ( addons ) {
305+ if ( addons . length > 0 ) {
306+ addons = addons . filter ( function ( addon ) {
307+ return addonsToSkip . indexOf ( addon ) == - 1 ;
308+ } ) ;
309+ }
310+ }
307311
308312 console . log ( "Reloading the addons folder, these were found:" ) ;
309313 console . log ( addons ) ;
@@ -571,15 +575,17 @@ ipc.on('update', function(event, arg) {
571575 '<strong>Success!</strong><br>' +
572576 'Updating your project was successful! <a href="file:///' + update [ 'updatePath' ] + '" class="monospace" data-toggle="external_target">' + update [ 'updatePath' ] + '</a><br><br>' +
573577 '<button class="btn btn-default console-feature" onclick="$(\'#fullConsoleOutput\').toggle();">Show full log</button><br>' +
574- '<div id="fullConsoleOutput"><br><textarea class="selectable">' + stdout + '</textarea></div>'
578+ '<div id="fullConsoleOutput"><br><textarea class="selectable">' + stdout + '\n\n\n(command used:' + wholeString + ')\n\n\n </textarea></div>'
575579 ) ;
580+
581+ //
576582 event . sender . send ( 'updateCompleted' , true ) ;
577583 } else {
578584 event . sender . send ( 'consoleMessage' , "<strong>" + wholeString + "</strong><br>" + error . message ) ;
579585 event . sender . send ( 'sendUIMessage' ,
580586 '<strong>Error...</strong><br>' +
581587 'There was a problem updating your project... <span class="monospace">' + update [ 'updatePath' ] + '</span>' +
582- '<div id="fullConsoleOutput" class="not-hidden"><br><textarea class="selectable">' + error . message + '</textarea></div>'
588+ '<div id="fullConsoleOutput" class="not-hidden"><br><textarea class="selectable">' + error . message + '\n\n\n(command used:' + wholeString + ')\n\n\n </textarea></div>'
583589 ) ;
584590 }
585591 } ) ;
@@ -665,7 +671,7 @@ ipc.on('generate', function(event, arg) {
665671 event . sender . send ( 'sendUIMessage' ,
666672 '<strong>Success!</strong><br>' +
667673 'Your can now find your project in <a href="file:///' + fullPath + '" data-toggle="external_target" class="monospace">' + fullPath + '</a><br><br>' +
668- '<div id="fullConsoleOutput" class="not-hidden"><br><textarea class="selectable">' + stdout + '</textarea></div>'
674+ '<div id="fullConsoleOutput" class="not-hidden"><br><textarea class="selectable">' + stdout + '\n\n\n(command used: ' + wholeString + ')\n\n\n </textarea></div>'
669675 ) ;
670676 event . sender . send ( 'generateCompleted' , true ) ;
671677 } else if ( error !== null ) {
@@ -684,7 +690,7 @@ ipc.on('generate', function(event, arg) {
684690 '<strong>Error!</strong><br>' +
685691 '<strong>Error...</strong><br>' +
686692 'There was a problem generating your project... <span class="monospace">' + fullPath + '</span>' +
687- '<div id="fullConsoleOutput" class="not-hidden"><br><textarea class="selectable">' + stdout + '</textarea></div>'
693+ '<div id="fullConsoleOutput" class="not-hidden"><br><textarea class="selectable">' + stdout + '\n\n\n(command used: ' + wholeString + ')\n\n\n </textarea></div>'
688694
689695 ) ;
690696
@@ -770,6 +776,55 @@ ipc.on('pickProjectImport', function(event, arg) {
770776 } ) ;
771777} ) ;
772778
779+
780+ ipc . on ( 'launchProjectinIDE' , function ( event , arg ) {
781+
782+ if ( arg . platform != obj . defaultPlatform ) {
783+ event . sender . send ( 'projectLaunchCompleted' , false ) ;
784+ return ;
785+ }
786+
787+ var pathTemp = require ( 'path' ) ;
788+ var fsTemp = require ( 'fs' ) ;
789+ var fullPath = pathTemp . join ( arg [ 'projectPath' ] , arg [ 'projectName' ] ) ;
790+
791+ if ( fsTemp . statSync ( fullPath ) . isDirectory ( ) == false ) {
792+ // project doesn't exist
793+ event . sender . send ( 'projectLaunchCompleted' , false ) ;
794+ return ;
795+ }
796+
797+ // // launch xcode
798+ if ( arg . platform == 'osx' ) {
799+ var osxPath = pathTemp . join ( fullPath , arg [ 'projectName' ] + '.xcodeproj' ) ;
800+ console . log ( osxPath ) ;
801+ if ( fsTemp . statSync ( osxPath ) . isDirectory ( ) == true ) { // note: .xcodeproj is a folder, not a file
802+ var exec = require ( 'child_process' ) . exec ;
803+ exec ( 'open ' + osxPath , function callback ( error , stdout , stderr ) {
804+ event . sender . send ( 'projectLaunchCompleted' , ( error == null ) ) ;
805+ return ;
806+ } ) ;
807+ }
808+ else {
809+ // console.log('OSX project file not found!');
810+ // event.sender.send('projectLaunchCompleted', false );
811+ // return;
812+ }
813+ }
814+
815+ // linux
816+ else if ( arg . platform == 'linux' || arg . platform == 'linux64' ) {
817+ // xdg-open $DESTINATION_PATH
818+ }
819+
820+ // unknown platform
821+ else {
822+ console . log ( "Unsupported platform for Launch feature..." ) ;
823+ event . sender . send ( 'projectLaunchCompleted' , false ) ;
824+ return ;
825+ }
826+ } ) ;
827+
773828ipc . on ( 'quit' , function ( event , arg ) {
774829 app . quit ( ) ;
775830} ) ;
0 commit comments