Skip to content

Commit 87796c1

Browse files
committed
Merge pull request #78 from openframeworks/windowsSpaceFix
fix for windows spaces, needs testing
2 parents 7123f96 + 51986b7 commit 87796c1

File tree

1 file changed

+19
-13
lines changed

1 file changed

+19
-13
lines changed

projectGeneratorElectron/index.js

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -564,8 +564,12 @@ ipc.on('update', function(event, arg) {
564564
var pgApp = pathTemp.normalize(pathTemp.join(pathTemp.join(__dirname, "app"), "projectGenerator"));
565565

566566

567-
pgApp = pgApp.replace(/ /g, '\\ ');
568-
567+
if( arg.platform == 'osx' || arg.platform == 'linux' || arg.platform == 'linux64' ){
568+
pgApp = pgApp.replace(/ /g, '\\ ');
569+
} else {
570+
pgApp = "\"" + pgApp + "\"";
571+
}
572+
569573
var wholeString = pgApp + " " + recursiveString + " " + verboseString + " " + pathString + " " + platformString + " " + updatePath;
570574

571575
exec(wholeString, function callback(error, stdout, stderr) {
@@ -646,7 +650,11 @@ ipc.on('generate', function(event, arg) {
646650
pgApp = pathTemp.normalize(pathTemp.join(pathTemp.join(__dirname, "app"), "projectGenerator"));
647651
}
648652

649-
pgApp = pgApp.replace(/ /g, '\\ ');
653+
if( arg.platform == 'osx' || arg.platform == 'linux' || arg.platform == 'linux64' ){
654+
pgApp = pgApp.replace(/ /g, '\\ ');
655+
} else {
656+
pgApp = pgApp = "\"" + pgApp + "\"";
657+
}
650658

651659
var wholeString = pgApp + " " + verboseString + " " + pathString + " " + addonString + " " + platformString + " " + projectString;
652660

@@ -799,17 +807,14 @@ ipc.on('launchProjectinIDE', function(event, arg) {
799807
if( arg.platform == 'osx' ){
800808
var osxPath = pathTemp.join(fullPath, arg['projectName'] + '.xcodeproj');
801809
console.log( osxPath );
802-
if( fsTemp.statSync(osxPath).isDirectory() == true ){ // note: .xcodeproj is a folder, not a file
803-
var exec = require('child_process').exec;
804-
exec('open ' + osxPath, function callback(error, stdout, stderr){
805-
return;
806-
});
807-
}
808-
else {
809-
console.log('OSX project file not found!');
810-
}
810+
osxPath = "\"" + osxPath + "\"";
811+
var exec = require('child_process').exec;
812+
exec('open ' + osxPath, function callback(error, stdout, stderr){
813+
return;
814+
});
811815
} else if( arg.platform == 'linux' || arg.platform == 'linux64' ){
812816
var linuxPath = pathTemp.join(fullPath, arg['projectName'] + '.qbs');
817+
linuxPath = linuxPath.replace(/ /g, '\\ ');
813818
console.log( linuxPath );
814819
var exec = require('child_process').exec;
815820
exec('xdg-open ' + linuxPath, function callback(error, stdout, stderr){
@@ -818,8 +823,9 @@ ipc.on('launchProjectinIDE', function(event, arg) {
818823
} else {
819824
var windowsPath = pathTemp.join(fullPath, arg['projectName'] + '.sln');
820825
console.log( windowsPath );
826+
windowsPath = "\"" + windowsPath + "\"";
821827
var exec = require('child_process').exec;
822-
exec('start ' + windowsPath, function callback(error, stdout, stderr){
828+
exec('start ' + "\"\"" + " " + windowsPath, function callback(error, stdout, stderr){
823829
return;
824830
});
825831
}

0 commit comments

Comments
 (0)