RAM2118 commited on
Commit
379e9dd
·
verified ·
1 Parent(s): 33d2e82

fix: Helper test-load — handle paths with spaces + allow message loop to run

Browse files

Bug 1: paths with spaces got split by tokenizer. Fix: join all args after --test.
Bug 2: some plugins need the JUCE message loop to finish loading (VST3 validation).
Fix: use a Timer to delay quit, giving the plugin time to initialize.

Files changed (1) hide show
  1. Source/Helper/main.cpp +24 -8
Source/Helper/main.cpp CHANGED
@@ -11,7 +11,7 @@
11
  // Usage: PluginBridgeHelper --test "/path/to/plugin.vst3"
12
  // Exit code 0 = safe, exit code 1 = failed to load, crash = unsafe
13
 
14
- class HelperApplication : public juce::JUCEApplication
15
  {
16
  public:
17
  const juce::String getApplicationName() override { return "PluginBridgeHelper"; }
@@ -19,18 +19,22 @@ public:
19
 
20
  void initialise(const juce::String& commandLine) override
21
  {
22
- auto args = juce::StringArray::fromTokens(commandLine, " ", "\"");
23
-
24
- juce::String pluginPath;
25
- for (int i = 0; i < args.size() - 1; ++i)
26
  {
27
- if (args[i] == "--test")
28
- pluginPath = args[i + 1];
 
 
29
  }
30
 
 
 
 
31
  if (pluginPath.isEmpty())
32
  {
33
- DBG("HelperApplication: Usage: --test \"/path/to/plugin.vst3\"");
34
  setApplicationReturnValue(1);
35
  quit();
36
  return;
@@ -38,6 +42,15 @@ public:
38
 
39
  DBG("HelperApplication: Testing plugin: " + pluginPath);
40
 
 
 
 
 
 
 
 
 
 
41
  HelperPluginHost host;
42
  bool success = host.testLoad(pluginPath);
43
 
@@ -57,6 +70,9 @@ public:
57
 
58
  void shutdown() override {}
59
  void systemRequestedQuit() override { quit(); }
 
 
 
60
  };
61
 
62
  START_JUCE_APPLICATION(HelperApplication)
 
11
  // Usage: PluginBridgeHelper --test "/path/to/plugin.vst3"
12
  // Exit code 0 = safe, exit code 1 = failed to load, crash = unsafe
13
 
14
+ class HelperApplication : public juce::JUCEApplication, private juce::Timer
15
  {
16
  public:
17
  const juce::String getApplicationName() override { return "PluginBridgeHelper"; }
 
19
 
20
  void initialise(const juce::String& commandLine) override
21
  {
22
+ // Parse --test flag. Everything after --test is the path (may contain spaces).
23
+ auto testFlagPos = commandLine.indexOf("--test");
24
+ if (testFlagPos < 0)
 
25
  {
26
+ DBG("HelperApplication: Usage: --test \"/path/to/plugin.vst3\"");
27
+ setApplicationReturnValue(1);
28
+ quit();
29
+ return;
30
  }
31
 
32
+ // Extract path: skip "--test " (7 chars), trim quotes
33
+ pluginPath = commandLine.substring(testFlagPos + 7).trim().unquoted();
34
+
35
  if (pluginPath.isEmpty())
36
  {
37
+ DBG("HelperApplication: No plugin path provided");
38
  setApplicationReturnValue(1);
39
  quit();
40
  return;
 
42
 
43
  DBG("HelperApplication: Testing plugin: " + pluginPath);
44
 
45
+ // Start test on a timer so the message loop is running
46
+ // (some plugins need it for VST3 validation)
47
+ startTimer(100);
48
+ }
49
+
50
+ void timerCallback() override
51
+ {
52
+ stopTimer();
53
+
54
  HelperPluginHost host;
55
  bool success = host.testLoad(pluginPath);
56
 
 
70
 
71
  void shutdown() override {}
72
  void systemRequestedQuit() override { quit(); }
73
+
74
+ private:
75
+ juce::String pluginPath;
76
  };
77
 
78
  START_JUCE_APPLICATION(HelperApplication)