Просмотр исходного кода

Fixed Mac build broken by Windows changes

Ivan Safrin 13 лет назад
Родитель
Сommit
a0b87eba59

+ 1 - 1
Core/Contents/Include/PolyCocoaCore.h

@@ -118,7 +118,7 @@ namespace Polycode {
 		String openFolderPicker();
 		vector<String> openFilePicker(vector<CoreFileExtension> extensions, bool allowMultiple);
 		
-		String executeExternalCommand(String command, String inDirectory="");
+		String executeExternalCommand(String command, String args, String inDirectory="");
 		
 		void launchApplicationWithFile(String application, String file);
 		void openFileWithApplication(String file, String application);

+ 8 - 2
Core/Contents/Source/PolyCocoaCore.mm

@@ -215,8 +215,14 @@ void CocoaCore::launchApplicationWithFile(String application, String file) {
 //Handle error
 }
 
-String CocoaCore::executeExternalCommand(String command,  String inDirectory) {
-	FILE *fp = popen(command.c_str(), "r");
+String CocoaCore::executeExternalCommand(String command,  String args, String inDirectory) {
+
+	String finalCommand = command+" "+args;
+	if(inDirectory != "") {
+		finalCommand = "cd "+inDirectory+" && "+finalCommand;
+	}
+	
+	FILE *fp = popen(finalCommand.c_str(), "r");
 	if(!fp) {
 		return "Unable to execute command";
 	}	

+ 9 - 4
IDE/Contents/Source/PolycodeToolLauncher.cpp

@@ -34,7 +34,9 @@ void PolycodeRunner::runThread() {
 	String polycodeBasePath = CoreServices::getInstance()->getCore()->getDefaultWorkingDirectory();
 
 #if defined(__APPLE__) && defined(__MACH__)
-	String command = "cd "+polycodeBasePath+"/Standalone/Player/PolycodePlayer.app/Contents/Resources && ../MacOS/PolycodePlayer "+polyappPath;	
+	String command = "../MacOS/PolycodePlayer";	
+	String inFolder = polycodeBasePath+"/Standalone/Player/PolycodePlayer.app/Contents/Resources";
+	String args = polyappPath;
 #elif defined _WINDOWS
 	String command = polycodeBasePath+"/Standalone/Player/PolycodePlayer.exe";
 	String args = polyappPath;
@@ -42,6 +44,7 @@ void PolycodeRunner::runThread() {
 #else
 	String command = "cd "+polycodeBasePath+"/Standalone/Player && ./PolycodePlayer "+polyappPath;
 #endif
+
 	String ret = CoreServices::getInstance()->getCore()->executeExternalCommand(command, args, inFolder);
 	CoreServices::getInstance()->getCore()->removeDiskItem(polyappPath);	
 }
@@ -84,9 +87,11 @@ void PolycodeToolLauncher::buildProject(PolycodeProject *project, String destina
 	String args =  "--config=\""+projectPath+"\" --out=\""+destinationPath+"\"";
 	String ret = CoreServices::getInstance()->getCore()->executeExternalCommand(command, args, targetFolder);
 #else
-	String command = "cd "+projectBasePath+" && "+polycodeBasePath+"/Standalone/Bin/polybuild  --config="+projectPath+" --out="+destinationPath;	
-	String ret = CoreServices::getInstance()->getCore()->executeExternalCommand(command);
-//	PolycodeConsole::print(ret);	
+	String command = polycodeBasePath+"/Standalone/Bin/polybuild";
+	String inFolder = projectBasePath; 
+	String args = "--config="+projectPath+" --out="+destinationPath;
+	String ret = CoreServices::getInstance()->getCore()->executeExternalCommand(command, args, inFolder);
+//	PolycodeConsole::print(ret);
 #endif
 
 }