瀏覽代碼

Fixed a bug that prevented Windows exe files from building when a Linux binary was already present.

David Piuva 3 年之前
父節點
當前提交
165d44f185
共有 2 個文件被更改,包括 11 次插入8 次删除
  1. 8 5
      Source/tools/builder/Machine.cpp
  2. 3 3
      Source/tools/builder/generator.cpp

+ 8 - 5
Source/tools/builder/Machine.cpp

@@ -256,12 +256,15 @@ void buildProject(ScriptTarget &output, const ReadableString &projectFilePath, M
 	// Find out where things are located.
 	String projectPath = file_getAbsoluteParentFolder(projectFilePath);
 	// Interpret ProgramPath relative to the project path.
-	ReadableString programPath = getFlag(settings, U"ProgramPath", output.language == ScriptLanguage::Batch ? U"program.exe" : U"program");
-	programPath = file_getTheoreticalAbsolutePath(programPath, projectPath);
+	String fullProgramPath = getFlag(settings, U"ProgramPath", U"program");
+	if (output.language == ScriptLanguage::Batch) {
+		string_append(fullProgramPath, U".exe");
+	}
+	fullProgramPath = file_getTheoreticalAbsolutePath(fullProgramPath, projectPath);
 	// If the SkipIfBinaryExists flag is given, we will abort as soon as we have handled its external BuildProjects requests and confirmed that the application exists.
-	if (getFlagAsInteger(settings, U"SkipIfBinaryExists") && file_getEntryType(programPath) == EntryType::File) {
+	if (getFlagAsInteger(settings, U"SkipIfBinaryExists") && file_getEntryType(fullProgramPath) == EntryType::File) {
 		// SkipIfBinaryExists was active and the binary exists, so abort here to avoid redundant work.
-		printText(U"Skipping build of ", projectFilePath, U" because the SkipIfBinaryExists flag was given.\n");
+		printText(U"Skipping build of ", projectFilePath, U" because the SkipIfBinaryExists flag was given and ", fullProgramPath, U" was found.\n");
 		return;
 	}
 	// Once we are done finding all source files, we can resolve the dependencies to create a graph connected by indices.
@@ -269,7 +272,7 @@ void buildProject(ScriptTarget &output, const ReadableString &projectFilePath, M
 	if (getFlagAsInteger(settings, U"ListDependencies")) {
 		printDependencies(context);
 	}
-	generateCompilationScript(output, context, settings, programPath);
+	generateCompilationScript(output, context, settings, fullProgramPath);
 }
 
 // Using a folder path and input arguments for all projects.

+ 3 - 3
Source/tools/builder/generator.cpp

@@ -208,11 +208,11 @@ static void script_printMessage(ScriptTarget &output, const ReadableString messa
 	}
 }
 
-static void script_executeLocalBinary(ScriptTarget &output, const ReadableString code) {
+static void script_executeLocalBinary(ScriptTarget &output, const ReadableString fullPath) {
 	if (output.language == ScriptLanguage::Batch) {
-		string_append(output.generatedCode, code, ".exe\n");
+		string_append(output.generatedCode, fullPath, U"\n");
 	} else if (output.language == ScriptLanguage::Bash) {
-		string_append(output.generatedCode, file_combinePaths(U".", code), U";\n");
+		string_append(output.generatedCode, fullPath, U";\n");
 	}
 }