diff --git a/extras/Projucer/Source/Application/jucer_CommandLine.cpp b/extras/Projucer/Source/Application/jucer_CommandLine.cpp index 475518f257..7a7da5fc59 100644 --- a/extras/Projucer/Source/Application/jucer_CommandLine.cpp +++ b/extras/Projucer/Source/Application/jucer_CommandLine.cpp @@ -776,11 +776,15 @@ namespace PIPGenerator generator (pipFile, outputDir); - if (! generator.createJucerFile()) - throw CommandLineError ("Failed to create .jucer file in " + outputDir.getFullPathName()+ "."); + auto createJucerFileResult = generator.createJucerFile(); - if (! generator.createMainCpp()) - throw CommandLineError ("Failed to create Main.cpp."); + if (! createJucerFileResult) + throw CommandLineError (createJucerFileResult.getErrorMessage()); + + auto createMainCppResult = generator.createMainCpp(); + + if (! createMainCppResult) + throw CommandLineError (createMainCppResult.getErrorMessage()); } //============================================================================== diff --git a/extras/Projucer/Source/Utility/PIPs/jucer_PIPGenerator.cpp b/extras/Projucer/Source/Utility/PIPs/jucer_PIPGenerator.cpp index cf2dcb801c..882d5974ea 100644 --- a/extras/Projucer/Source/Utility/PIPs/jucer_PIPGenerator.cpp +++ b/extras/Projucer/Source/Utility/PIPs/jucer_PIPGenerator.cpp @@ -142,20 +142,20 @@ Result PIPGenerator::createJucerFile() if (xml->writeToFile (outputFile, {})) return Result::ok(); - else - return Result::fail ("Failed to create .jucer file in " + outputDirectory.getFullPathName()+ "."); + + return Result::fail ("Failed to create .jucer file in " + outputDirectory.getFullPathName()); } -bool PIPGenerator::createMainCpp() +Result PIPGenerator::createMainCpp() { auto outputFile = outputDirectory.getChildFile ("Source").getChildFile ("Main.cpp"); if (! outputFile.existsAsFile() && (outputFile.create() != Result::ok())) - return false; + return Result::fail ("Failed to create Main.cpp - " + outputFile.getFullPathName()); outputFile.replaceWithText (getMainFileTextForType()); - return true; + return Result::ok(); } //============================================================================== diff --git a/extras/Projucer/Source/Utility/PIPs/jucer_PIPGenerator.h b/extras/Projucer/Source/Utility/PIPs/jucer_PIPGenerator.h index 2502ff8536..ac3608489b 100644 --- a/extras/Projucer/Source/Utility/PIPs/jucer_PIPGenerator.h +++ b/extras/Projucer/Source/Utility/PIPs/jucer_PIPGenerator.h @@ -45,7 +45,7 @@ public: //============================================================================== Result createJucerFile(); - bool createMainCpp(); + Result createMainCpp(); private: //==============================================================================