mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-26 02:14:22 +00:00
ApplicationBase: Assume UTF-8 commandline parameter encoding
This commit is contained in:
parent
3b8c26eff3
commit
c8753dcc9a
1 changed files with 11 additions and 8 deletions
|
|
@ -199,14 +199,12 @@ String JUCEApplicationBase::getCommandLineParameters()
|
|||
{
|
||||
String argString;
|
||||
|
||||
for (int i = 1; i < juce_argc; ++i)
|
||||
for (const auto& arg : getCommandLineParameterArray())
|
||||
{
|
||||
String arg { CharPointer_UTF8 (juce_argv[i]) };
|
||||
|
||||
if (arg.containsChar (' ') && ! arg.isQuotedString())
|
||||
arg = arg.quoted ('"');
|
||||
|
||||
argString << arg << ' ';
|
||||
const auto withQuotes = arg.containsChar (' ') && ! arg.isQuotedString()
|
||||
? arg.quoted ('"')
|
||||
: arg;
|
||||
argString << withQuotes << ' ';
|
||||
}
|
||||
|
||||
return argString.trim();
|
||||
|
|
@ -214,7 +212,12 @@ String JUCEApplicationBase::getCommandLineParameters()
|
|||
|
||||
StringArray JUCEApplicationBase::getCommandLineParameterArray()
|
||||
{
|
||||
return StringArray (juce_argv + 1, juce_argc - 1);
|
||||
StringArray result;
|
||||
|
||||
for (int i = 1; i < juce_argc; ++i)
|
||||
result.add (CharPointer_UTF8 (juce_argv[i]));
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
int JUCEApplicationBase::main (int argc, const char* argv[])
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue