1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-10 23:44:24 +00:00

FileChooser: Allow new filechooser to load paths containing unicode characters

This commit is contained in:
reuk 2020-11-30 18:17:43 +00:00
parent 1ec24991e8
commit 6ac0e90e58
No known key found for this signature in database
GPG key ID: 9ADCD339CFC98A11

View file

@ -234,8 +234,12 @@ private:
};
LPWSTR ptr = nullptr;
item.GetDisplayName (SIGDN_URL, &ptr);
return std::unique_ptr<WCHAR, Free> { ptr };
if (item.GetDisplayName (SIGDN_FILESYSPATH, &ptr) != S_OK)
return URL();
const auto path = std::unique_ptr<WCHAR, Free> { ptr };
return URL (File (String (path.get())));
};
if (isSave)
@ -262,7 +266,12 @@ private:
if (item == nullptr)
return {};
return { URL (String (getUrl (*item).get())) };
const auto url = getUrl (*item);
if (url.isEmpty())
return {};
return { url };
}
const auto dialog = [&]
@ -298,7 +307,12 @@ private:
items->GetItemAt (i, scope.resetAndGetPointerAddress());
if (scope != nullptr)
result.add (String (getUrl (*scope).get()));
{
const auto url = getUrl (*scope);
if (! url.isEmpty())
result.add (url);
}
}
return result;