Skip to content

Commit

Permalink
Added a getArgumentAfterOption due to removed behaviour in juce::Argu…
Browse files Browse the repository at this point in the history
…mentList to fix some tests
  • Loading branch information
drowaudio committed Mar 20, 2019
1 parent 716e4de commit b488fbb
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
3 changes: 3 additions & 0 deletions CHANGELIST.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# pluginval Change List

### 0.2.3
- Fixed some failing tests on startup

### 0.2.2
- Added a test for disabled HiDPI awareness on Windows
- Updated JUCE to v5.4.3
Expand Down
15 changes: 12 additions & 3 deletions Source/CommandLine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -111,16 +111,25 @@ void CommandLineValidator::connectionLost()


//==============================================================================
static inline ArgumentList::Argument getArgumentAfterOption (const ArgumentList& args, StringRef option)
{
for (int i = 0; i < args.size() - 1; ++i)
if (args[i] == option)
return args[i + 1];

return {};
}

static var getOptionValue (const ArgumentList& args, StringRef option, var defaultValue, StringRef errorMessage)
{
if (args.containsOption (option))
{
const auto nextArg = args.getValueForOption (option);
const auto nextArg = getArgumentAfterOption (args, option);

if (nextArg.isEmpty())
if (nextArg.isShortOption() || nextArg.isLongOption())
ConsoleApplication::fail (errorMessage, -1);

return nextArg;
return nextArg.text;
}

return defaultValue;
Expand Down

0 comments on commit b488fbb

Please sign in to comment.