Skip to content

Commit ffaa46f

Browse files
committed
meta export for Daisy
1 parent a64503a commit ffaa46f

File tree

3 files changed

+10
-6
lines changed

3 files changed

+10
-6
lines changed

Source/Heavy/DPFExporter.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ class DPFExporter final : public ExporterBase {
206206
metaJson->setProperty("nosimd", nosimd);
207207

208208
auto metaJsonFile = createMetaJson(metaJson);
209-
args.add("-m" + metaJsonFile);
209+
args.add("-m" + metaJsonFile.getFullPathName());
210210

211211
args.add("-v");
212212
args.add("-gdpf");
@@ -243,8 +243,7 @@ class DPFExporter final : public ExporterBase {
243243
}
244244

245245
if (exportType == 3 || exportType == 4) {
246-
auto metaFile = File(metaJsonFile);
247-
metaFile.copyFileTo(outputFile.getChildFile("meta.json"));
246+
metaJsonFile.copyFileTo(outputFile.getChildFile("meta.json"));
248247
}
249248

250249
// Delay to get correct exit code

Source/Heavy/DaisyExporter.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,8 @@ class DaisyExporter final : public ExporterBase {
330330
}
331331

332332
metaJson->setProperty("daisy", metaDaisy);
333-
args.add("-m" + createMetaJson(metaJson));
333+
auto metaJsonFile = createMetaJson(metaJson);
334+
args.add("-m" + metaJsonFile.getFullPathName());
334335

335336
args.add("-v");
336337
args.add("-gdaisy");
@@ -359,6 +360,10 @@ class DaisyExporter final : public ExporterBase {
359360

360361
bool heavyExitCode = getExitCode();
361362

363+
if (heavyExitCode == 0) {
364+
metaJsonFile.copyFileTo(outputFile.getChildFile("meta.json"));
365+
}
366+
362367
if (compile) {
363368
auto bin = Toolchain::dir.getChildFile("bin");
364369
auto libDaisy = Toolchain::dir.getChildFile("lib").getChildFile("libdaisy");

Source/Heavy/ExporterBase.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -213,13 +213,13 @@ struct ExporterBase : public Component
213213
exportButton.setBounds(getLocalBounds().removeFromBottom(23).removeFromRight(80).translated(-10, -10));
214214
}
215215

216-
static String createMetaJson(DynamicObject::Ptr const& metaJson)
216+
File createMetaJson(DynamicObject::Ptr const& metaJson)
217217
{
218218
auto const metadata = File::createTempFile(".json");
219219
Toolchain::deleteTempFileLater(metadata);
220220
String const metaString = JSON::toString(var(metaJson.get()));
221221
metadata.replaceWithText(metaString, false, false, "\n");
222-
return metadata.getFullPathName();
222+
return metadata;
223223
}
224224

225225
private:

0 commit comments

Comments
 (0)