Bladeren bron

Projects without an explicitly assigned program path will now default to the name of the project file, so that multiple projects in the same folder don't default into overwriting the same executable.

David Piuva 3 jaren geleden
bovenliggende
commit
b6c32af876
1 gewijzigde bestanden met toevoegingen van 5 en 2 verwijderingen
  1. 5 2
      Source/tools/builder/Machine.cpp

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

@@ -256,11 +256,14 @@ void buildProject(ScriptTarget &output, const ReadableString &projectFilePath, M
 	evaluateScript(output, context, settings, projectFilePath);
 	evaluateScript(output, context, settings, projectFilePath);
 	// Find out where things are located.
 	// Find out where things are located.
 	String projectPath = file_getAbsoluteParentFolder(projectFilePath);
 	String projectPath = file_getAbsoluteParentFolder(projectFilePath);
-	// Interpret ProgramPath relative to the project path.
-	String fullProgramPath = getFlag(settings, U"ProgramPath", U"program");
+	// Get the project's name.
+	String projectName = file_getPathlessName(file_getExtensionless(projectFilePath));
+	// If no application path is given, the new executable will be named after the project and placed in the same folder.
+	String fullProgramPath = getFlag(settings, U"ProgramPath", projectName);
 	if (output.language == ScriptLanguage::Batch) {
 	if (output.language == ScriptLanguage::Batch) {
 		string_append(fullProgramPath, U".exe");
 		string_append(fullProgramPath, U".exe");
 	}
 	}
+	// Interpret ProgramPath relative to the project path.
 	fullProgramPath = file_getTheoreticalAbsolutePath(fullProgramPath, projectPath);
 	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 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(fullProgramPath) == EntryType::File) {
 	if (getFlagAsInteger(settings, U"SkipIfBinaryExists") && file_getEntryType(fullProgramPath) == EntryType::File) {