@@ -123,28 +123,29 @@ class OWLExporter : public ExporterBase {
123123 if (shouldQuit)
124124 return true ;
125125
126+ // Delay to get correct exit code
127+ Time::waitForMillisecondCounter (Time::getMillisecondCounter () + 300 );
128+
126129 auto outputFile = File (outdir);
127130 auto sourceDir = outputFile.getChildFile (" Source" );
128131
129132 bool heavyExitCode = getExitCode ();
130133
131- outputFile.getChildFile (" ir" ).deleteRecursively ();
132- outputFile.getChildFile (" hv" ).deleteRecursively ();
133- outputFile.getChildFile (" c" ).deleteRecursively ();
134-
135- auto OWL = Toolchain::dir.getChildFile (" lib" ).getChildFile (" OwlProgram" );
136- OWL.copyDirectoryTo (outputFile.getChildFile (" OwlProgram" ));
137-
138- // Delay to get correct exit code
139- Time::waitForMillisecondCounter (Time::getMillisecondCounter () + 300 );
140-
141134 if (compile) {
142135 auto workingDir = File::getCurrentWorkingDirectory ();
143136
144137 auto bin = Toolchain::dir.getChildFile (" bin" );
138+ auto OWL = Toolchain::dir.getChildFile (" lib" ).getChildFile (" OwlProgram" );
145139 auto make = bin.getChildFile (" make" + exeSuffix);
146140 auto compiler = bin.getChildFile (" arm-none-eabi-gcc" + exeSuffix);
147141
142+ OWL.copyDirectoryTo (outputFile.getChildFile (" OwlProgram" ));
143+
144+ outputFile.getChildFile (" ir" ).deleteRecursively ();
145+ outputFile.getChildFile (" hv" ).deleteRecursively ();
146+ outputFile.getChildFile (" c" ).deleteRecursively ();
147+
148+ // Run from within OwlProgram directory
148149 auto OwlDir = outputFile.getChildFile (" OwlProgram" );
149150 OwlDir.setAsCurrentWorkingDirectory ();
150151 OwlDir.getChildFile (" Tools/FirmwareSender" + exeSuffix).setExecutePermission (1 );
@@ -218,6 +219,9 @@ class OWLExporter : public ExporterBase {
218219 } else {
219220 auto outputFile = File (outdir);
220221
222+ auto OWL = Toolchain::dir.getChildFile (" lib" ).getChildFile (" OwlProgram" );
223+ OWL.copyDirectoryTo (outputFile.getChildFile (" OwlProgram" ));
224+
221225 outputFile.getChildFile (" ir" ).deleteRecursively ();
222226 outputFile.getChildFile (" hv" ).deleteRecursively ();
223227 outputFile.getChildFile (" c" ).deleteRecursively ();
0 commit comments