mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-28 02:30:05 +00:00
Fixes for file-filter separator token parsing on linux zenity and win32.
This commit is contained in:
parent
2860f66953
commit
9efbd199a6
2 changed files with 11 additions and 5 deletions
|
|
@ -131,11 +131,11 @@ static void addZenityArgs (StringArray& args, String& separator,
|
|||
|
||||
if (filters.isNotEmpty() && filters != "*" && filters != "*.*")
|
||||
{
|
||||
args.add ("--file-filter");
|
||||
args.add (filters.replaceCharacter (';', ' '));
|
||||
StringArray tokens;
|
||||
tokens.addTokens (filters, ";,|", "\"");
|
||||
|
||||
args.add ("--file-filter");
|
||||
args.add ("All files | *");
|
||||
for (int i = 0; i < tokens.size(); ++i)
|
||||
args.add ("--file-filter='" + tokens[i] + "'");
|
||||
}
|
||||
|
||||
if (file.isDirectory())
|
||||
|
|
|
|||
|
|
@ -218,6 +218,8 @@ void FileChooser::showPlatformDialog (Array<File>& results, const String& title_
|
|||
info.customComponent->enterModalState();
|
||||
}
|
||||
|
||||
const StringRef separatorTokens (";,|");
|
||||
|
||||
const size_t filterSpaceNumChars = 2048;
|
||||
HeapBlock<WCHAR> filters;
|
||||
filters.calloc (filterSpaceNumChars);
|
||||
|
|
@ -225,6 +227,10 @@ void FileChooser::showPlatformDialog (Array<File>& results, const String& title_
|
|||
filter.copyToUTF16 (filters + (bytesWritten / sizeof (WCHAR)),
|
||||
((filterSpaceNumChars - 1) * sizeof (WCHAR) - bytesWritten));
|
||||
|
||||
for (int i = 0; i < filterSpaceNumChars; ++i)
|
||||
if (separatorTokens.text.indexOf ((juce_wchar) filters[i]) >= 0)
|
||||
filters[i] = 0;
|
||||
|
||||
OPENFILENAMEW of = { 0 };
|
||||
String localPath (info.initialPath);
|
||||
|
||||
|
|
@ -249,7 +255,7 @@ void FileChooser::showPlatformDialog (Array<File>& results, const String& title_
|
|||
if (isSaveDialogue)
|
||||
{
|
||||
StringArray tokens;
|
||||
tokens.addTokens (filter, ";,", "\"'");
|
||||
tokens.addTokens (filter, separatorTokens, "\"'");
|
||||
tokens.trim();
|
||||
tokens.removeEmptyStrings();
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue