mirror of https://github.com/libsdl-org/SDL.git
Dialog: XDG Portals: Remove the `file://` URI
This commit is contained in:
parent
6e081eb7dc
commit
3acca27e95
|
|
@ -226,6 +226,8 @@ static DBusHandlerResult DBus_MessageFilter(DBusConnection *conn, DBusMessage *m
|
||||||
|
|
||||||
while (dbus->message_iter_get_arg_type(&uri_entry) == DBUS_TYPE_STRING)
|
while (dbus->message_iter_get_arg_type(&uri_entry) == DBUS_TYPE_STRING)
|
||||||
{
|
{
|
||||||
|
const char *uri = NULL;
|
||||||
|
|
||||||
if (current >= length - 1) {
|
if (current >= length - 1) {
|
||||||
++length;
|
++length;
|
||||||
path = SDL_realloc(path, sizeof(const char *) * length);
|
path = SDL_realloc(path, sizeof(const char *) * length);
|
||||||
|
|
@ -234,7 +236,18 @@ static DBusHandlerResult DBus_MessageFilter(DBusConnection *conn, DBusMessage *m
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
dbus->message_iter_get_basic(&uri_entry, path + current);
|
|
||||||
|
dbus->message_iter_get_basic(&uri_entry, &uri);
|
||||||
|
|
||||||
|
/* https://flatpak.github.io/xdg-desktop-portal/docs/doc-org.freedesktop.portal.FileChooser.html */
|
||||||
|
/* Returned paths will always start with 'file://'; truncate it */
|
||||||
|
if (SDL_strncmp(uri, "file://", SDL_strlen("file://"))) {
|
||||||
|
path[current] = uri + SDL_strlen("file://");
|
||||||
|
} else if (SDL_strstr(uri, "://")) {
|
||||||
|
SDL_SetError("Portal dialogs: Unsupported protocol: %s", uri);
|
||||||
|
signal_data->callback(signal_data->userdata, NULL, -1);
|
||||||
|
goto cleanup;
|
||||||
|
}
|
||||||
|
|
||||||
dbus->message_iter_next(&uri_entry);
|
dbus->message_iter_next(&uri_entry);
|
||||||
++current;
|
++current;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue