From f2ea85c23f4202116256910c7fca0c5086217103 Mon Sep 17 00:00:00 2001 From: dreamer Date: Sat, 30 Aug 2025 22:33:15 +0200 Subject: [PATCH 01/10] try escaping output and search paths --- Source/Heavy/CppExporter.h | 9 ++++----- Source/Heavy/DPFExporter.h | 9 ++++----- Source/Heavy/DaisyExporter.h | 16 ++++++++-------- Source/Heavy/ExporterBase.h | 8 ++------ Source/Heavy/OWLExporter.h | 9 ++++----- Source/Heavy/PdExporter.h | 9 ++++----- Source/Heavy/WASMExporter.h | 4 ++-- 7 files changed, 28 insertions(+), 36 deletions(-) diff --git a/Source/Heavy/CppExporter.h b/Source/Heavy/CppExporter.h index a6cc5933e5..2d1e00ffdd 100644 --- a/Source/Heavy/CppExporter.h +++ b/Source/Heavy/CppExporter.h @@ -33,14 +33,14 @@ class CppExporter final : public ExporterBase { { exportingView->showState(ExportingProgressView::Exporting); - StringArray args = { heavyExecutable.getFullPathName(), pdPatch, "-o" + outdir }; + StringArray args = { heavyExecutable.getFullPathName(), pdPatch, "-o", outdir }; name = name.replaceCharacter('-', '_'); args.add("-n" + name); if (copyright.isNotEmpty()) { args.add("--copyright"); - args.add("\"" + copyright + "\""); + args.add(copyright.quoted()); } args.add("-v"); @@ -55,9 +55,8 @@ class CppExporter final : public ExporterBase { if (shouldQuit) return true; - auto compileString = args.joinIntoString(" "); - exportingView->logToConsole("Command: " + compileString + "\n"); - start(compileString); + exportingView->logToConsole("Command: " + args.joinIntoString(" ") + "\n"); + start(args); waitForProcessToFinish(-1); exportingView->flushConsole(); diff --git a/Source/Heavy/DPFExporter.h b/Source/Heavy/DPFExporter.h index d1811995a4..87f6c214a2 100644 --- a/Source/Heavy/DPFExporter.h +++ b/Source/Heavy/DPFExporter.h @@ -136,14 +136,14 @@ class DPFExporter final : public ExporterBase { { exportingView->showState(ExportingProgressView::Exporting); - StringArray args = { heavyExecutable.getFullPathName(), pdPatch, "-o" + outdir }; + StringArray args = { heavyExecutable.getFullPathName(), pdPatch, "-o", outdir }; name = name.replaceCharacter('-', '_'); args.add("-n" + name); if (copyright.isNotEmpty()) { args.add("--copyright"); - args.add("\"" + copyright + "\""); + args.add(copyright.quoted()); } auto makerName = getValue(makerNameValue); @@ -221,9 +221,8 @@ class DPFExporter final : public ExporterBase { if (shouldQuit) return true; - auto compileString = args.joinIntoString(" "); - exportingView->logToConsole("Command: " + compileString + "\n"); - start(compileString); + exportingView->logToConsole("Command: " + args.joinIntoString(" ") + "\n"); + start(args); waitForProcessToFinish(-1); exportingView->flushConsole(); diff --git a/Source/Heavy/DaisyExporter.h b/Source/Heavy/DaisyExporter.h index e740ced55f..f63bc7356d 100644 --- a/Source/Heavy/DaisyExporter.h +++ b/Source/Heavy/DaisyExporter.h @@ -249,14 +249,15 @@ class DaisyExporter final : public ExporterBase { auto size = getValue(patchSizeValue); auto appType = getValue(appTypeValue); - StringArray args = { heavyExecutable.getFullPathName(), pdPatch, "-o" + outdir }; + + StringArray args = { heavyExecutable.getFullPathName(), pdPatch, "-o", outdir}; name = name.replaceCharacter('-', '_'); args.add("-n" + name); if (copyright.isNotEmpty()) { args.add("--copyright"); - args.add("\"" + copyright + "\""); + args.add(copyright.quoted()); } // set board definition @@ -331,7 +332,7 @@ class DaisyExporter final : public ExporterBase { metaJson->setProperty("daisy", metaDaisy); auto metaJsonFile = createMetaJson(metaJson); - args.add("-m" + metaJsonFile.getFullPathName()); + args.add("-m" + metaJsonFile.getFullPathName().quoted()); args.add("-v"); args.add("-gdaisy"); @@ -343,9 +344,8 @@ class DaisyExporter final : public ExporterBase { args.add(paths); - auto compileString = args.joinIntoString(" "); - exportingView->logToConsole("Command: " + compileString + "\n"); - start(compileString); + exportingView->logToConsole("Command: " + args.joinIntoString(" ") + "\n"); + start(args); waitForProcessToFinish(-1); exportingView->flushConsole(); @@ -385,7 +385,7 @@ class DaisyExporter final : public ExporterBase { #if JUCE_WINDOWS auto buildScript = make.getFullPathName().replaceCharacter('\\', '/') + " -j4 -f " - + sourceDir.getChildFile("Makefile").getFullPathName().replaceCharacter('\\', '/') + + sourceDir.getChildFile("Makefile").getFullPathName().replaceCharacter('\\', '/').quoted() + " GCC_PATH=" + gccPath.replaceCharacter('\\', '/') + " PROJECT_NAME=" + name; @@ -393,7 +393,7 @@ class DaisyExporter final : public ExporterBase { Toolchain::startShellScript(buildScript, this); #else String buildScript = make.getFullPathName() - + " -j4 -f " + sourceDir.getChildFile("Makefile").getFullPathName() + + " -j4 -f " + sourceDir.getChildFile("Makefile").getFullPathName().quoted() + " GCC_PATH=" + gccPath + " PROJECT_NAME=" + name; diff --git a/Source/Heavy/ExporterBase.h b/Source/Heavy/ExporterBase.h index aecf878ed3..f0a3a917e5 100644 --- a/Source/Heavy/ExporterBase.h +++ b/Source/Heavy/ExporterBase.h @@ -140,7 +140,7 @@ struct ExporterBase : public Component } // Add original file location to search paths - auto searchPaths = StringArray { realPatchFile.getParentDirectory().getFullPathName() }; + auto searchPaths = StringArray { realPatchFile.getParentDirectory().getFullPathName().quoted()}; editor->pd->setThis(); @@ -149,12 +149,8 @@ struct ExporterBase : public Component int numItems; pd::Interface::getSearchPaths(paths, &numItems); - if (realPatchFile.existsAsFile()) { - searchPaths.add(realPatchFile.getParentDirectory().getFullPathName()); - } - for (int i = 0; i < numItems; i++) { - searchPaths.add(paths[i]); + searchPaths.add(String(paths[i]).quoted()); } // Make sure we don't add the file location twice diff --git a/Source/Heavy/OWLExporter.h b/Source/Heavy/OWLExporter.h index 11ac73ea63..fd0bbadf2e 100644 --- a/Source/Heavy/OWLExporter.h +++ b/Source/Heavy/OWLExporter.h @@ -94,14 +94,14 @@ class OWLExporter : public ExporterBase { bool store = getValue(exportTypeValue) == 4; int slot = getValue(storeSlotValue); - StringArray args = { heavyExecutable.getFullPathName(), pdPatch, "-o" + outdir }; + StringArray args = { heavyExecutable.getFullPathName(), pdPatch, "-o", outdir }; name = name.replaceCharacter('-', '_'); args.add("-n" + name); if (copyright.isNotEmpty()) { args.add("--copyright"); - args.add("\"" + copyright + "\""); + args.add(copyright.quoted()); } args.add("-v"); @@ -114,9 +114,8 @@ class OWLExporter : public ExporterBase { args.add(paths); - auto compileString = args.joinIntoString(" "); - exportingView->logToConsole("Command: " + compileString + "\n"); - start(compileString); + exportingView->logToConsole("Command: " + args.joinIntoString(" ") + "\n"); + start(args); waitForProcessToFinish(-1); exportingView->flushConsole(); diff --git a/Source/Heavy/PdExporter.h b/Source/Heavy/PdExporter.h index 08fa7bdb2d..8b67d3d7ef 100644 --- a/Source/Heavy/PdExporter.h +++ b/Source/Heavy/PdExporter.h @@ -65,14 +65,14 @@ class PdExporter final : public ExporterBase { { exportingView->showState(ExportingProgressView::Exporting); - StringArray args = { heavyExecutable.getFullPathName(), pdPatch, "-o" + outdir }; + StringArray args = { heavyExecutable.getFullPathName(), pdPatch, "-o", outdir }; name = name.replaceCharacter('-', '_'); args.add("-n" + name); if (copyright.isNotEmpty()) { args.add("--copyright"); - args.add("\"" + copyright + "\""); + args.add(copyright.quoted()); } args.add("-v"); @@ -88,9 +88,8 @@ class PdExporter final : public ExporterBase { if (shouldQuit) return true; - auto compileString = args.joinIntoString(" "); - exportingView->logToConsole("Command: " + compileString + "\n"); - start(compileString); + exportingView->logToConsole("Command: " + args.joinIntoString(" ") + "\n"); + start(args); waitForProcessToFinish(-1); exportingView->flushConsole(); diff --git a/Source/Heavy/WASMExporter.h b/Source/Heavy/WASMExporter.h index c2e08cbe67..325fbd7bcb 100644 --- a/Source/Heavy/WASMExporter.h +++ b/Source/Heavy/WASMExporter.h @@ -65,7 +65,7 @@ class WASMExporter : public ExporterBase { #if JUCE_WINDOWS StringArray args = { heavyExecutable.getFullPathName().replaceCharacter('\\', '/'), pdPatch.replaceCharacter('\\', '/'), "-o" + outdir.replaceCharacter('\\', '/') }; #else - StringArray args = { heavyExecutable.getFullPathName(), pdPatch, "-o" + outdir }; + StringArray args = { heavyExecutable.getFullPathName(), pdPatch, "-o", outdir }; #endif name = name.replaceCharacter('-', '_'); @@ -73,7 +73,7 @@ class WASMExporter : public ExporterBase { if (copyright.isNotEmpty()) { args.add("--copyright"); - args.add("\"" + copyright + "\""); + args.add(copyright.quoted()); } auto emsdkPath = getValue(emsdkPathValue); From 25d2c5634d88b8b0355d385562c05a0300a8eddc Mon Sep 17 00:00:00 2001 From: Timothy Schoen Date: Sat, 13 Sep 2025 15:45:59 +0200 Subject: [PATCH 02/10] Clean up --- Source/PluginProcessor.cpp | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/Source/PluginProcessor.cpp b/Source/PluginProcessor.cpp index 2c0b9e65e9..01f2cafa34 100644 --- a/Source/PluginProcessor.cpp +++ b/Source/PluginProcessor.cpp @@ -1437,23 +1437,25 @@ void PluginProcessor::runBackupLoop() backupRunLoopInterval *= 2; // Increase the interval so we get correct timing } - if(backupLoopLock.tryEnter()) { - if(isProcessingAudio) - { - backupRunLoop.stopTimer(); - backupLoopLock.exit(); + { + ScopedTryLock const scopedTimerLock(backupLoopLock); + if(scopedTimerLock.isLocked()) { + if(isProcessingAudio) + { + backupRunLoop.stopTimer(); + return; + } + + backupRunLoop.startTimer(backupRunLoopInterval); + } + else { return; } - - backupRunLoop.startTimer(backupRunLoopInterval); - backupLoopLock.exit(); - } - else { - return; } setThis(); - if(audioLock.tryEnter()) { + ScopedTryLock const scopedAudioLock(backupLoopLock); + if(scopedAudioLock.isLocked()) { sendMessagesFromQueue(); sendParameters(); for(int i = 0; i < blocksToProcess; i++) { @@ -1461,7 +1463,6 @@ void PluginProcessor::runBackupLoop() sys_pollgui(); sched_tick_nodsp(); } - audioLock.exit(); } } From dde332798d33f9b0c45c2aa5fad3f627268bc01f Mon Sep 17 00:00:00 2001 From: Timothy Schoen Date: Sun, 14 Sep 2025 13:46:40 +0200 Subject: [PATCH 03/10] Fix Windows unable to find bash sometimes --- Source/Heavy/DPFExporter.h | 4 ++-- Source/Heavy/DaisyExporter.h | 1 + Source/Heavy/ExporterBase.h | 7 +++++-- Source/Heavy/OWLExporter.h | 3 ++- Source/Heavy/PdExporter.h | 3 ++- 5 files changed, 12 insertions(+), 6 deletions(-) diff --git a/Source/Heavy/DPFExporter.h b/Source/Heavy/DPFExporter.h index 87f6c214a2..0b7ac5222d 100644 --- a/Source/Heavy/DPFExporter.h +++ b/Source/Heavy/DPFExporter.h @@ -267,8 +267,8 @@ class DPFExporter final : public ExporterBase { auto path = "export PATH=\"$PATH:" + Toolchain::dir.getChildFile("bin").getFullPathName().replaceCharacter('\\', '/') + "\"\n"; auto cc = "CC=" + Toolchain::dir.getChildFile("bin").getChildFile("gcc.exe").getFullPathName().replaceCharacter('\\', '/') + " "; auto cxx = "CXX=" + Toolchain::dir.getChildFile("bin").getChildFile("g++.exe").getFullPathName().replaceCharacter('\\', '/') + " "; - - Toolchain::startShellScript(path + cc + cxx + make.getFullPathName().replaceCharacter('\\', '/') + " -j4 -f " + makefile.getFullPathName().replaceCharacter('\\', '/'), this); + auto shell = " SHELL=" + Toolchain::dir.getChildFile("bin").getChildFile("bash.exe").getFullPathName().replaceCharacter('\\', '/').quoted(); + Toolchain::startShellScript(path + cc + cxx + make.getFullPathName().replaceCharacter('\\', '/') + " -j4 -f " + makefile.getFullPathName().replaceCharacter('\\', '/') + shell, this); #else // Linux or BSD auto prepareEnvironmentScript = Toolchain::dir.getChildFile("scripts").getChildFile("anywhere-setup.sh").getFullPathName() + "\n"; diff --git a/Source/Heavy/DaisyExporter.h b/Source/Heavy/DaisyExporter.h index f63bc7356d..22cbf0ab25 100644 --- a/Source/Heavy/DaisyExporter.h +++ b/Source/Heavy/DaisyExporter.h @@ -386,6 +386,7 @@ class DaisyExporter final : public ExporterBase { auto buildScript = make.getFullPathName().replaceCharacter('\\', '/') + " -j4 -f " + sourceDir.getChildFile("Makefile").getFullPathName().replaceCharacter('\\', '/').quoted() + + " SHELL=" + Toolchain::dir.getChildFile("bin").getChildFile("bash.exe").getFullPathName().replaceCharacter('\\', '/').quoted() + " GCC_PATH=" + gccPath.replaceCharacter('\\', '/') + " PROJECT_NAME=" + name; diff --git a/Source/Heavy/ExporterBase.h b/Source/Heavy/ExporterBase.h index f0a3a917e5..ce0f66a257 100644 --- a/Source/Heavy/ExporterBase.h +++ b/Source/Heavy/ExporterBase.h @@ -140,8 +140,11 @@ struct ExporterBase : public Component } // Add original file location to search paths - auto searchPaths = StringArray { realPatchFile.getParentDirectory().getFullPathName().quoted()}; - + auto searchPaths = StringArray {}; + if (realPatchFile.existsAsFile() && !realPatchFile.isRoot()) + { + searchPaths.add(realPatchFile.getParentDirectory().getFullPathName().replaceCharacter('\\', '/').quoted()); + } editor->pd->setThis(); // Get pd's search paths diff --git a/Source/Heavy/OWLExporter.h b/Source/Heavy/OWLExporter.h index fd0bbadf2e..1b68dd37c2 100644 --- a/Source/Heavy/OWLExporter.h +++ b/Source/Heavy/OWLExporter.h @@ -163,7 +163,8 @@ class OWLExporter : public ExporterBase { + " BUILD=../" + " PATCHNAME=" + name + " PATCHCLASS=HeavyPatch" - + " PATCHFILE=HeavyOWL_" + name + ".hpp"; + + " PATCHFILE=HeavyOWL_" + name + ".hpp" + + " SHELL=" + Toolchain::dir.getChildFile("bin").getChildFile("bash.exe").getFullPathName().replaceCharacter('\\', '/').quoted(); #else buildScript += make.getFullPathName() + " -j4" diff --git a/Source/Heavy/PdExporter.h b/Source/Heavy/PdExporter.h index 8b67d3d7ef..b9ad7945f1 100644 --- a/Source/Heavy/PdExporter.h +++ b/Source/Heavy/PdExporter.h @@ -129,8 +129,9 @@ class PdExporter final : public ExporterBase { auto cc = "CC=" + Toolchain::dir.getChildFile("bin").getChildFile("gcc.exe").getFullPathName().replaceCharacter('\\', '/') + " "; auto cxx = "CXX=" + Toolchain::dir.getChildFile("bin").getChildFile("g++.exe").getFullPathName().replaceCharacter('\\', '/') + " "; auto pdbindir = "PDBINDIR=\"" + pdDll.getFullPathName().replaceCharacter('\\', '/') + "\" "; + auto shell = " SHELL=" + Toolchain::dir.getChildFile("bin").getChildFile("bash.exe").getFullPathName().replaceCharacter('\\', '/').quoted(); - Toolchain::startShellScript(path + cc + cxx + pdbindir + make.getFullPathName().replaceCharacter('\\', '/') + " -j4", this); + Toolchain::startShellScript(path + cc + cxx + pdbindir + make.getFullPathName().replaceCharacter('\\', '/') + " -j4" + shell, this); #else // Linux or BSD auto prepareEnvironmentScript = Toolchain::dir.getChildFile("scripts").getChildFile("anywhere-setup.sh").getFullPathName() + "\n"; From 1a04ad346f9a7c923a031ce78eaf5aeeb18974c9 Mon Sep 17 00:00:00 2001 From: Timothy Schoen Date: Sun, 14 Sep 2025 14:45:13 +0200 Subject: [PATCH 04/10] Fix problems with spaces in search paths, clean up --- Source/Heavy/DPFExporter.h | 11 +++++------ Source/Heavy/DaisyExporter.h | 15 +++++++-------- Source/Heavy/ExporterBase.h | 4 ++++ Source/Heavy/OWLExporter.h | 6 ++---- Source/Heavy/PdExporter.h | 11 +++++------ Source/Heavy/WASMExporter.h | 10 ++-------- 6 files changed, 25 insertions(+), 32 deletions(-) diff --git a/Source/Heavy/DPFExporter.h b/Source/Heavy/DPFExporter.h index 0b7ac5222d..d7233ca670 100644 --- a/Source/Heavy/DPFExporter.h +++ b/Source/Heavy/DPFExporter.h @@ -211,18 +211,17 @@ class DPFExporter final : public ExporterBase { args.add("-v"); args.add("-gdpf"); - String paths = "-p"; + args.add("-p"); for (auto& path : searchPaths) { - paths += " " + path; + args.add(path); } - args.add(paths); - if (shouldQuit) return true; - exportingView->logToConsole("Command: " + args.joinIntoString(" ") + "\n"); - start(args); + auto const command = args.joinIntoString(" "); + exportingView->logToConsole("Command: " + command + "\n"); + Toolchain::startShellScript(command, this); waitForProcessToFinish(-1); exportingView->flushConsole(); diff --git a/Source/Heavy/DaisyExporter.h b/Source/Heavy/DaisyExporter.h index 22cbf0ab25..7ee8875efa 100644 --- a/Source/Heavy/DaisyExporter.h +++ b/Source/Heavy/DaisyExporter.h @@ -249,8 +249,8 @@ class DaisyExporter final : public ExporterBase { auto size = getValue(patchSizeValue); auto appType = getValue(appTypeValue); - - StringArray args = { heavyExecutable.getFullPathName(), pdPatch, "-o", outdir}; + + StringArray args = { heavyExecutable.getFullPathName(), pdPatch, "-o", outdir.quoted()}; name = name.replaceCharacter('-', '_'); args.add("-n" + name); @@ -337,15 +337,14 @@ class DaisyExporter final : public ExporterBase { args.add("-v"); args.add("-gdaisy"); - String paths = "-p"; + args.add("-p"); for (auto& path : searchPaths) { - paths += " " + path; + args.add(path); } - args.add(paths); - - exportingView->logToConsole("Command: " + args.joinIntoString(" ") + "\n"); - start(args); + auto const command = args.joinIntoString(" "); + exportingView->logToConsole("Command: " + command + "\n"); + Toolchain::startShellScript(command, this); waitForProcessToFinish(-1); exportingView->flushConsole(); diff --git a/Source/Heavy/ExporterBase.h b/Source/Heavy/ExporterBase.h index ce0f66a257..5772936e2a 100644 --- a/Source/Heavy/ExporterBase.h +++ b/Source/Heavy/ExporterBase.h @@ -143,7 +143,11 @@ struct ExporterBase : public Component auto searchPaths = StringArray {}; if (realPatchFile.existsAsFile() && !realPatchFile.isRoot()) { +#if JUCE_WINDOWS searchPaths.add(realPatchFile.getParentDirectory().getFullPathName().replaceCharacter('\\', '/').quoted()); +#else + searchPaths.add(realPatchFile.getParentDirectory().getFullPathName().quoted()); +#endif } editor->pd->setThis(); diff --git a/Source/Heavy/OWLExporter.h b/Source/Heavy/OWLExporter.h index 1b68dd37c2..0068cb6c93 100644 --- a/Source/Heavy/OWLExporter.h +++ b/Source/Heavy/OWLExporter.h @@ -107,13 +107,11 @@ class OWLExporter : public ExporterBase { args.add("-v"); args.add("-gOWL"); - String paths = "-p"; + args.add("-p"); for (auto& path : searchPaths) { - paths += " " + path; + args.add(path); } - args.add(paths); - exportingView->logToConsole("Command: " + args.joinIntoString(" ") + "\n"); start(args); diff --git a/Source/Heavy/PdExporter.h b/Source/Heavy/PdExporter.h index b9ad7945f1..1bdc2674f0 100644 --- a/Source/Heavy/PdExporter.h +++ b/Source/Heavy/PdExporter.h @@ -78,18 +78,17 @@ class PdExporter final : public ExporterBase { args.add("-v"); args.add("-gpdext"); - String paths = "-p"; + args.add("-p"); for (auto& path : searchPaths) { - paths += " " + path; + args.add(path); } - args.add(paths); - if (shouldQuit) return true; - exportingView->logToConsole("Command: " + args.joinIntoString(" ") + "\n"); - start(args); + auto const command = args.joinIntoString(" "); + exportingView->logToConsole("Command: " + command + "\n"); + Toolchain::startShellScript(command, this); waitForProcessToFinish(-1); exportingView->flushConsole(); diff --git a/Source/Heavy/WASMExporter.h b/Source/Heavy/WASMExporter.h index 325fbd7bcb..025835869e 100644 --- a/Source/Heavy/WASMExporter.h +++ b/Source/Heavy/WASMExporter.h @@ -81,17 +81,11 @@ class WASMExporter : public ExporterBase { args.add("-v"); args.add("-gjs"); - String paths = "-p"; + args.add("-p"); for (auto& path : searchPaths) { -#if JUCE_WINDOWS - paths += " " + path.replaceCharacter('\\', '/'); -#else - paths += " " + path; -#endif + args.add(path); } - args.add(paths); - if (shouldQuit) return true; From 3bc6232f404b04f6c3c9a586cd872dde833feceb Mon Sep 17 00:00:00 2001 From: Timothy Schoen Date: Sun, 14 Sep 2025 13:43:28 +0200 Subject: [PATCH 05/10] Fix Windows backslash paths issue, pass strings as reference --- Source/Heavy/CppExporter.h | 10 +++++++--- Source/Heavy/DPFExporter.h | 10 +++++++--- Source/Heavy/DaisyExporter.h | 13 ++++++++----- Source/Heavy/ExporterBase.h | 15 ++++++++++----- Source/Heavy/OWLExporter.h | 10 +++++++--- Source/Heavy/PdExporter.h | 10 +++++++--- Source/Heavy/WASMExporter.h | 11 +++++------ 7 files changed, 51 insertions(+), 28 deletions(-) diff --git a/Source/Heavy/CppExporter.h b/Source/Heavy/CppExporter.h index 2d1e00ffdd..701c6df3d6 100644 --- a/Source/Heavy/CppExporter.h +++ b/Source/Heavy/CppExporter.h @@ -29,13 +29,17 @@ class CppExporter final : public ExporterBase { projectCopyrightValue = tree.getProperty("projectCopyrightValue"); } - bool performExport(String pdPatch, String const outdir, String name, String const copyright, StringArray searchPaths) override + bool performExport(String const& pdPatch, String const& outdir, String const& name, String const& copyright, StringArray const& searchPaths) override { exportingView->showState(ExportingProgressView::Exporting); - StringArray args = { heavyExecutable.getFullPathName(), pdPatch, "-o", outdir }; +#if JUCE_WINDOWS + auto const heavyPath = heavyExecutable.getFullPathName().replaceCharacter('\\', '/'); +#else + auto const heavyPath = heavyExecutable.getFullPathName(); +#endif + StringArray args = { heavyPath, pdPatch, "-o", outdir.quoted() }; - name = name.replaceCharacter('-', '_'); args.add("-n" + name); if (copyright.isNotEmpty()) { diff --git a/Source/Heavy/DPFExporter.h b/Source/Heavy/DPFExporter.h index d7233ca670..25003ec894 100644 --- a/Source/Heavy/DPFExporter.h +++ b/Source/Heavy/DPFExporter.h @@ -132,13 +132,17 @@ class DPFExporter final : public ExporterBase { } } - bool performExport(String pdPatch, String outdir, String name, String copyright, StringArray searchPaths) override + bool performExport(String const& pdPatch, String const& outdir, String const& name, String const& copyright, StringArray const& searchPaths) override { exportingView->showState(ExportingProgressView::Exporting); - StringArray args = { heavyExecutable.getFullPathName(), pdPatch, "-o", outdir }; +#if JUCE_WINDOWS + auto const heavyPath = heavyExecutable.getFullPathName().replaceCharacter('\\', '/'); +#else + auto const heavyPath = heavyExecutable.getFullPathName(); +#endif + StringArray args = { heavyPath, pdPatch, "-o", outdir.quoted() }; - name = name.replaceCharacter('-', '_'); args.add("-n" + name); if (copyright.isNotEmpty()) { diff --git a/Source/Heavy/DaisyExporter.h b/Source/Heavy/DaisyExporter.h index 7ee8875efa..63487f8643 100644 --- a/Source/Heavy/DaisyExporter.h +++ b/Source/Heavy/DaisyExporter.h @@ -237,7 +237,7 @@ class DaisyExporter final : public ExporterBase { return getExitCode(); } - bool performExport(String pdPatch, String outdir, String name, String copyright, StringArray searchPaths) override + bool performExport(String const& pdPatch, String const& outdir, String const& name, String const& copyright, StringArray const& searchPaths) override { auto target = getValue(targetBoardValue) - 1; bool compile = getValue(exportTypeValue) - 1; @@ -248,11 +248,14 @@ class DaisyExporter final : public ExporterBase { auto rate = getValue(samplerateValue) - 1; auto size = getValue(patchSizeValue); auto appType = getValue(appTypeValue); + +#if JUCE_WINDOWS + auto const heavyPath = heavyExecutable.getFullPathName().replaceCharacter('\\', '/'); +#else + auto const heavyPath = heavyExecutable.getFullPathName(); +#endif + StringArray args = { heavyPath, pdPatch, "-o", outdir.quoted() }; - - StringArray args = { heavyExecutable.getFullPathName(), pdPatch, "-o", outdir.quoted()}; - - name = name.replaceCharacter('-', '_'); args.add("-n" + name); if (copyright.isNotEmpty()) { diff --git a/Source/Heavy/ExporterBase.h b/Source/Heavy/ExporterBase.h index 5772936e2a..3bd2b82bc5 100644 --- a/Source/Heavy/ExporterBase.h +++ b/Source/Heavy/ExporterBase.h @@ -127,8 +127,14 @@ struct ExporterBase : public Component void startExport(File const& outDir) { +#if JUCE_WINDOWS + auto const patchPath = patchFile.getFullPathName().replaceCharacter('\\', '/'); + auto const& outPath = outDir.getFullPathName().replaceCharacter('\\', '/'); +#else auto patchPath = patchFile.getFullPathName(); auto const& outPath = outDir.getFullPathName(); +#endif + auto projectTitle = projectNameValue.toString(); auto projectCopyright = projectCopyrightValue.toString(); @@ -138,10 +144,11 @@ struct ExporterBase : public Component else projectTitle = "Untitled"; } + projectTitle = projectTitle.replaceCharacter('-', '_'); // Add original file location to search paths auto searchPaths = StringArray {}; - if (realPatchFile.existsAsFile() && !realPatchFile.isRoot()) + if (realPatchFile.existsAsFile() && !realPatchFile.isRoot()) // Make sure file actually exists { #if JUCE_WINDOWS searchPaths.add(realPatchFile.getParentDirectory().getFullPathName().replaceCharacter('\\', '/').quoted()); @@ -162,12 +169,10 @@ struct ExporterBase : public Component // Make sure we don't add the file location twice searchPaths.removeDuplicates(false); - addJob([this, patchPath, outPath, projectTitle, projectCopyright, searchPaths]() mutable { exportingView->monitorProcessOutput(this); - exportingView->showState(ExportingProgressView::Exporting); - + auto const result = performExport(patchPath, outPath, projectTitle, projectCopyright, searchPaths); if (shouldQuit) @@ -226,5 +231,5 @@ struct ExporterBase : public Component } private: - virtual bool performExport(String pdPatch, String outdir, String name, String copyright, StringArray searchPaths) = 0; + virtual bool performExport(String const& pdPatch, String const& outdir, String const& name, String const& copyright, StringArray const& searchPaths) = 0; }; diff --git a/Source/Heavy/OWLExporter.h b/Source/Heavy/OWLExporter.h index 0068cb6c93..916129925c 100644 --- a/Source/Heavy/OWLExporter.h +++ b/Source/Heavy/OWLExporter.h @@ -86,7 +86,7 @@ class OWLExporter : public ExporterBase { storeSlotProperty->setEnabled(exportType == 4); } - bool performExport(String pdPatch, String outdir, String name, String copyright, StringArray searchPaths) override + bool performExport(String const& pdPatch, String const& outdir, String const& name, String const& copyright, StringArray const& searchPaths) override { auto target = getValue(targetBoardValue); bool compile = getValue(exportTypeValue) - 1; @@ -94,9 +94,13 @@ class OWLExporter : public ExporterBase { bool store = getValue(exportTypeValue) == 4; int slot = getValue(storeSlotValue); - StringArray args = { heavyExecutable.getFullPathName(), pdPatch, "-o", outdir }; +#if JUCE_WINDOWS + auto const heavyPath = heavyExecutable.getFullPathName().replaceCharacter('\\', '/'); +#else + auto const heavyPath = heavyExecutable.getFullPathName(); +#endif + StringArray args = { heavyPath, pdPatch, "-o", outdir.quoted() }; - name = name.replaceCharacter('-', '_'); args.add("-n" + name); if (copyright.isNotEmpty()) { diff --git a/Source/Heavy/PdExporter.h b/Source/Heavy/PdExporter.h index 1bdc2674f0..e2c1a0fe1f 100644 --- a/Source/Heavy/PdExporter.h +++ b/Source/Heavy/PdExporter.h @@ -61,13 +61,17 @@ class PdExporter final : public ExporterBase { } } - bool performExport(String pdPatch, String const outdir, String name, String const copyright, StringArray searchPaths) override + bool performExport(String const& pdPatch, String const& outdir, String const &name, String const& copyright, StringArray const& searchPaths) override { exportingView->showState(ExportingProgressView::Exporting); - StringArray args = { heavyExecutable.getFullPathName(), pdPatch, "-o", outdir }; +#if JUCE_WINDOWS + auto const heavyPath = heavyExecutable.getFullPathName().replaceCharacter('\\', '/'); +#else + auto const heavyPath = heavyExecutable.getFullPathName(); +#endif + StringArray args = { heavyPath, pdPatch, "-o", outdir.quoted() }; - name = name.replaceCharacter('-', '_'); args.add("-n" + name); if (copyright.isNotEmpty()) { diff --git a/Source/Heavy/WASMExporter.h b/Source/Heavy/WASMExporter.h index 025835869e..0642a44699 100644 --- a/Source/Heavy/WASMExporter.h +++ b/Source/Heavy/WASMExporter.h @@ -58,17 +58,16 @@ class WASMExporter : public ExporterBase { } } - bool performExport(String pdPatch, String outdir, String name, String copyright, StringArray searchPaths) override + bool performExport(String const& pdPatch, String const& outdir, String const& name, String const& copyright, StringArray const& searchPaths) override { exportingView->showState(ExportingProgressView::Exporting); -#if JUCE_WINDOWS - StringArray args = { heavyExecutable.getFullPathName().replaceCharacter('\\', '/'), pdPatch.replaceCharacter('\\', '/'), "-o" + outdir.replaceCharacter('\\', '/') }; + #if JUCE_WINDOWS + auto const heavyPath = heavyExecutable.getFullPathName().replaceCharacter('\\', '/'); #else - StringArray args = { heavyExecutable.getFullPathName(), pdPatch, "-o", outdir }; + auto const heavyPath = heavyExecutable.getFullPathName(); #endif - - name = name.replaceCharacter('-', '_'); + StringArray args = { heavyPath, pdPatch, "-o", outdir.quoted() }; args.add("-n" + name); if (copyright.isNotEmpty()) { From bb4d9cbfd27f54d33221c4917886ac97ba846054 Mon Sep 17 00:00:00 2001 From: Timothy Schoen Date: Sun, 14 Sep 2025 13:47:01 +0200 Subject: [PATCH 06/10] Fix Heavy cpp exporter --- Source/Heavy/CppExporter.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Source/Heavy/CppExporter.h b/Source/Heavy/CppExporter.h index 701c6df3d6..9466e553c4 100644 --- a/Source/Heavy/CppExporter.h +++ b/Source/Heavy/CppExporter.h @@ -59,8 +59,9 @@ class CppExporter final : public ExporterBase { if (shouldQuit) return true; - exportingView->logToConsole("Command: " + args.joinIntoString(" ") + "\n"); - start(args); + auto const command = args.joinIntoString(" "); + exportingView->logToConsole("Command: " + command + "\n"); + Toolchain::startShellScript(command, this); waitForProcessToFinish(-1); exportingView->flushConsole(); From 7e5d79c1dd4740768bd97ce76f4133837af7d72d Mon Sep 17 00:00:00 2001 From: Timothy Schoen Date: Sun, 14 Sep 2025 13:48:19 +0200 Subject: [PATCH 07/10] Fix Heavy cpp exporter consistency --- Source/Heavy/CppExporter.h | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/Source/Heavy/CppExporter.h b/Source/Heavy/CppExporter.h index 9466e553c4..46a92d571e 100644 --- a/Source/Heavy/CppExporter.h +++ b/Source/Heavy/CppExporter.h @@ -49,13 +49,11 @@ class CppExporter final : public ExporterBase { args.add("-v"); - String paths = "-p"; + args.add("-p"); for (auto& path : searchPaths) { - paths += " " + path; + args.add(path); } - args.add(paths); - if (shouldQuit) return true; From d22de29dea12fbd4ee1aeedaac4afd1324dd544f Mon Sep 17 00:00:00 2001 From: Timothy Schoen Date: Sun, 14 Sep 2025 14:02:36 +0200 Subject: [PATCH 08/10] Quote all the paths! --- Source/Heavy/CppExporter.h | 2 +- Source/Heavy/DPFExporter.h | 2 +- Source/Heavy/DaisyExporter.h | 2 +- Source/Heavy/OWLExporter.h | 2 +- Source/Heavy/PdExporter.h | 2 +- Source/Heavy/WASMExporter.h | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Source/Heavy/CppExporter.h b/Source/Heavy/CppExporter.h index 46a92d571e..7de7c76e0e 100644 --- a/Source/Heavy/CppExporter.h +++ b/Source/Heavy/CppExporter.h @@ -38,7 +38,7 @@ class CppExporter final : public ExporterBase { #else auto const heavyPath = heavyExecutable.getFullPathName(); #endif - StringArray args = { heavyPath, pdPatch, "-o", outdir.quoted() }; + StringArray args = { heavyPath.quoted(), pdPatch.quoted(), "-o", outdir.quoted() }; args.add("-n" + name); diff --git a/Source/Heavy/DPFExporter.h b/Source/Heavy/DPFExporter.h index 25003ec894..4c0abcf597 100644 --- a/Source/Heavy/DPFExporter.h +++ b/Source/Heavy/DPFExporter.h @@ -141,7 +141,7 @@ class DPFExporter final : public ExporterBase { #else auto const heavyPath = heavyExecutable.getFullPathName(); #endif - StringArray args = { heavyPath, pdPatch, "-o", outdir.quoted() }; + StringArray args = { heavyPath.quoted(), pdPatch.quoted(), "-o", outdir.quoted() }; args.add("-n" + name); diff --git a/Source/Heavy/DaisyExporter.h b/Source/Heavy/DaisyExporter.h index 63487f8643..4e1731f9a5 100644 --- a/Source/Heavy/DaisyExporter.h +++ b/Source/Heavy/DaisyExporter.h @@ -254,7 +254,7 @@ class DaisyExporter final : public ExporterBase { #else auto const heavyPath = heavyExecutable.getFullPathName(); #endif - StringArray args = { heavyPath, pdPatch, "-o", outdir.quoted() }; + StringArray args = { heavyPath.quoted(), pdPatch.quoted(), "-o", outdir.quoted() }; args.add("-n" + name); diff --git a/Source/Heavy/OWLExporter.h b/Source/Heavy/OWLExporter.h index 916129925c..63bb1b7ac6 100644 --- a/Source/Heavy/OWLExporter.h +++ b/Source/Heavy/OWLExporter.h @@ -99,7 +99,7 @@ class OWLExporter : public ExporterBase { #else auto const heavyPath = heavyExecutable.getFullPathName(); #endif - StringArray args = { heavyPath, pdPatch, "-o", outdir.quoted() }; + StringArray args = { heavyPath.quoted(), pdPatch.quoted(), "-o", outdir.quoted() }; args.add("-n" + name); diff --git a/Source/Heavy/PdExporter.h b/Source/Heavy/PdExporter.h index e2c1a0fe1f..1eafb6486f 100644 --- a/Source/Heavy/PdExporter.h +++ b/Source/Heavy/PdExporter.h @@ -70,7 +70,7 @@ class PdExporter final : public ExporterBase { #else auto const heavyPath = heavyExecutable.getFullPathName(); #endif - StringArray args = { heavyPath, pdPatch, "-o", outdir.quoted() }; + StringArray args = { heavyPath.quoted(), pdPatch.quoted(), "-o", outdir.quoted() }; args.add("-n" + name); diff --git a/Source/Heavy/WASMExporter.h b/Source/Heavy/WASMExporter.h index 0642a44699..b37e488536 100644 --- a/Source/Heavy/WASMExporter.h +++ b/Source/Heavy/WASMExporter.h @@ -67,7 +67,7 @@ class WASMExporter : public ExporterBase { #else auto const heavyPath = heavyExecutable.getFullPathName(); #endif - StringArray args = { heavyPath, pdPatch, "-o", outdir.quoted() }; + StringArray args = { heavyPath.quoted(), pdPatch.quoted(), "-o", outdir.quoted() }; args.add("-n" + name); if (copyright.isNotEmpty()) { From f4701251e1a8eb9ed19c1fd778736070978cb8a4 Mon Sep 17 00:00:00 2001 From: Timothy Schoen Date: Sun, 14 Sep 2025 15:55:49 +0200 Subject: [PATCH 09/10] Adjust reported toolchain size --- Source/Heavy/Toolchain.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Source/Heavy/Toolchain.h b/Source/Heavy/Toolchain.h index 203bab1248..43ecb5ed62 100644 --- a/Source/Heavy/Toolchain.h +++ b/Source/Heavy/Toolchain.h @@ -326,11 +326,11 @@ class ToolchainInstaller final : public Component int statusCode = 0; #if JUCE_WINDOWS - String downloadSize = "1.2 GB"; + String downloadSize = "1.13 GB"; #elif JUCE_MAC - String downloadSize = "457 MB"; + String downloadSize = "460 MB"; #else - String downloadSize = "1.1 GB"; + String downloadSize = "805 MB"; #endif class ToolchainInstallerButton final : public Component { From 5867c32de1fc9ba2adf07cb20aba6f05a1c524ac Mon Sep 17 00:00:00 2001 From: Timothy Schoen Date: Sun, 14 Sep 2025 16:07:13 +0200 Subject: [PATCH 10/10] Correction for Linux toolchain size --- Source/Heavy/Toolchain.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/Heavy/Toolchain.h b/Source/Heavy/Toolchain.h index 43ecb5ed62..28767609d4 100644 --- a/Source/Heavy/Toolchain.h +++ b/Source/Heavy/Toolchain.h @@ -330,7 +330,7 @@ class ToolchainInstaller final : public Component #elif JUCE_MAC String downloadSize = "460 MB"; #else - String downloadSize = "805 MB"; + String downloadSize = "799 MB"; #endif class ToolchainInstallerButton final : public Component {