Skip to content

Commit 376e4d2

Browse files
dromertimothyschoen
authored andcommitted
try escaping output and search paths
1 parent 0677e32 commit 376e4d2

File tree

7 files changed

+23
-31
lines changed

7 files changed

+23
-31
lines changed

Source/Heavy/CppExporter.h

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ class CppExporter final : public ExporterBase {
3333
{
3434
exportingView->showState(ExportingProgressView::Exporting);
3535

36-
StringArray args = { heavyExecutable.getFullPathName(), pdPatch, "-o" + outdir };
36+
StringArray args = { heavyExecutable.getFullPathName(), pdPatch, "-o", outdir };
3737

3838
name = name.replaceCharacter('-', '_');
3939
args.add("-n" + name);
@@ -55,9 +55,8 @@ class CppExporter final : public ExporterBase {
5555
if (shouldQuit)
5656
return true;
5757

58-
auto compileString = args.joinIntoString(" ");
59-
exportingView->logToConsole("Command: " + compileString + "\n");
60-
start(compileString);
58+
exportingView->logToConsole("Command: " + args.joinIntoString(" ") + "\n");
59+
start(args);
6160

6261
waitForProcessToFinish(-1);
6362
exportingView->flushConsole();

Source/Heavy/DPFExporter.h

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ class DPFExporter final : public ExporterBase {
136136
{
137137
exportingView->showState(ExportingProgressView::Exporting);
138138

139-
StringArray args = { heavyExecutable.getFullPathName(), pdPatch, "-o" + outdir };
139+
StringArray args = { heavyExecutable.getFullPathName(), pdPatch, "-o", outdir };
140140

141141
name = name.replaceCharacter('-', '_');
142142
args.add("-n" + name);
@@ -221,9 +221,8 @@ class DPFExporter final : public ExporterBase {
221221
if (shouldQuit)
222222
return true;
223223

224-
auto compileString = args.joinIntoString(" ");
225-
exportingView->logToConsole("Command: " + compileString + "\n");
226-
start(compileString);
224+
exportingView->logToConsole("Command: " + args.joinIntoString(" ") + "\n");
225+
start(args);
227226

228227
waitForProcessToFinish(-1);
229228
exportingView->flushConsole();

Source/Heavy/DaisyExporter.h

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -249,14 +249,15 @@ class DaisyExporter final : public ExporterBase {
249249
auto size = getValue<int>(patchSizeValue);
250250
auto appType = getValue<int>(appTypeValue);
251251

252-
StringArray args = { heavyExecutable.getFullPathName(), pdPatch, "-o" + outdir };
252+
253+
StringArray args = { heavyExecutable.getFullPathName(), pdPatch, "-o", outdir};
253254

254255
name = name.replaceCharacter('-', '_');
255256
args.add("-n" + name);
256257

257258
if (copyright.isNotEmpty()) {
258259
args.add("--copyright");
259-
args.add("\"" + copyright + "\"");
260+
args.add(copyright.quoted());
260261
}
261262

262263
// set board definition
@@ -331,7 +332,7 @@ class DaisyExporter final : public ExporterBase {
331332

332333
metaJson->setProperty("daisy", metaDaisy);
333334
auto metaJsonFile = createMetaJson(metaJson);
334-
args.add("-m" + metaJsonFile.getFullPathName());
335+
args.add("-m" + metaJsonFile.getFullPathName().quoted());
335336

336337
args.add("-v");
337338
args.add("-gdaisy");
@@ -343,9 +344,8 @@ class DaisyExporter final : public ExporterBase {
343344

344345
args.add(paths);
345346

346-
auto compileString = args.joinIntoString(" ");
347-
exportingView->logToConsole("Command: " + compileString + "\n");
348-
start(compileString);
347+
exportingView->logToConsole("Command: " + args.joinIntoString(" ") + "\n");
348+
start(args);
349349
waitForProcessToFinish(-1);
350350
exportingView->flushConsole();
351351

@@ -385,15 +385,15 @@ class DaisyExporter final : public ExporterBase {
385385
#if JUCE_WINDOWS
386386
auto buildScript = make.getFullPathName().replaceCharacter('\\', '/')
387387
+ " -j4 -f "
388-
+ sourceDir.getChildFile("Makefile").getFullPathName().replaceCharacter('\\', '/')
388+
+ sourceDir.getChildFile("Makefile").getFullPathName().replaceCharacter('\\', '/').quoted()
389389
+ " GCC_PATH="
390390
+ gccPath.replaceCharacter('\\', '/')
391391
+ " PROJECT_NAME=" + name;
392392

393393
Toolchain::startShellScript(buildScript, this);
394394
#else
395395
String buildScript = make.getFullPathName()
396-
+ " -j4 -f " + sourceDir.getChildFile("Makefile").getFullPathName()
396+
+ " -j4 -f " + sourceDir.getChildFile("Makefile").getFullPathName().quoted()
397397
+ " GCC_PATH=" + gccPath
398398
+ " PROJECT_NAME=" + name;
399399

Source/Heavy/ExporterBase.h

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ struct ExporterBase : public Component
140140
}
141141

142142
// Add original file location to search paths
143-
auto searchPaths = StringArray { realPatchFile.getParentDirectory().getFullPathName() };
143+
auto searchPaths = StringArray { realPatchFile.getParentDirectory().getFullPathName().quoted()};
144144

145145
editor->pd->setThis();
146146

@@ -149,12 +149,8 @@ struct ExporterBase : public Component
149149
int numItems;
150150
pd::Interface::getSearchPaths(paths, &numItems);
151151

152-
if (realPatchFile.existsAsFile()) {
153-
searchPaths.add(realPatchFile.getParentDirectory().getFullPathName());
154-
}
155-
156152
for (int i = 0; i < numItems; i++) {
157-
searchPaths.add(paths[i]);
153+
searchPaths.add(String(paths[i]).quoted());
158154
}
159155

160156
// Make sure we don't add the file location twice

Source/Heavy/OWLExporter.h

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ class OWLExporter : public ExporterBase {
9494
bool store = getValue<int>(exportTypeValue) == 4;
9595
int slot = getValue<int>(storeSlotValue);
9696

97-
StringArray args = { heavyExecutable.getFullPathName(), pdPatch, "-o" + outdir };
97+
StringArray args = { heavyExecutable.getFullPathName(), pdPatch, "-o", outdir };
9898

9999
name = name.replaceCharacter('-', '_');
100100
args.add("-n" + name);
@@ -114,9 +114,8 @@ class OWLExporter : public ExporterBase {
114114

115115
args.add(paths);
116116

117-
auto compileString = args.joinIntoString(" ");
118-
exportingView->logToConsole("Command: " + compileString + "\n");
119-
start(compileString);
117+
exportingView->logToConsole("Command: " + args.joinIntoString(" ") + "\n");
118+
start(args);
120119

121120
waitForProcessToFinish(-1);
122121
exportingView->flushConsole();

Source/Heavy/PdExporter.h

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ class PdExporter final : public ExporterBase {
6565
{
6666
exportingView->showState(ExportingProgressView::Exporting);
6767

68-
StringArray args = { heavyExecutable.getFullPathName(), pdPatch, "-o" + outdir };
68+
StringArray args = { heavyExecutable.getFullPathName(), pdPatch, "-o", outdir };
6969

7070
name = name.replaceCharacter('-', '_');
7171
args.add("-n" + name);
@@ -88,9 +88,8 @@ class PdExporter final : public ExporterBase {
8888
if (shouldQuit)
8989
return true;
9090

91-
auto compileString = args.joinIntoString(" ");
92-
exportingView->logToConsole("Command: " + compileString + "\n");
93-
start(compileString);
91+
exportingView->logToConsole("Command: " + args.joinIntoString(" ") + "\n");
92+
start(args);
9493

9594
waitForProcessToFinish(-1);
9695
exportingView->flushConsole();

Source/Heavy/WASMExporter.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ class WASMExporter : public ExporterBase {
6565
#if JUCE_WINDOWS
6666
StringArray args = { heavyExecutable.getFullPathName().replaceCharacter('\\', '/'), pdPatch.replaceCharacter('\\', '/'), "-o" + outdir.replaceCharacter('\\', '/') };
6767
#else
68-
StringArray args = { heavyExecutable.getFullPathName(), pdPatch, "-o" + outdir };
68+
StringArray args = { heavyExecutable.getFullPathName(), pdPatch, "-o", outdir };
6969
#endif
7070

7171
name = name.replaceCharacter('-', '_');

0 commit comments

Comments
 (0)