mirror of
https://github.com/Relintai/sdl2_frt.git
synced 2024-12-20 22:16:49 +01:00
url: Another attempt at WinRT implementation.
This commit is contained in:
parent
1f4b5d54ca
commit
02addf135d
@ -21,22 +21,21 @@
|
|||||||
|
|
||||||
#include <Windows.h>
|
#include <Windows.h>
|
||||||
|
|
||||||
|
#include "../../core/windows/SDL_windows.h"
|
||||||
#include "../SDL_sysurl.h"
|
#include "../SDL_sysurl.h"
|
||||||
|
|
||||||
int
|
int
|
||||||
SDL_SYS_OpenURL(const char *url)
|
SDL_SYS_OpenURL(const char *url)
|
||||||
{
|
{
|
||||||
auto uri = ref new Windows::Foundation::Uri(url);
|
WCHAR *wurl = WIN_UTF8ToString(url);
|
||||||
concurrency::task<bool> launchUriOperation(Windows::System::Launcher::LaunchUriAsync(uri));
|
if (wurl == NULL) {
|
||||||
int retval = -1;
|
return SDL_OutOfMemory();
|
||||||
launchUriOperation.then([](bool success) {
|
|
||||||
if (success) {
|
|
||||||
retval = 0;
|
|
||||||
} else {
|
|
||||||
retval = SDL_SetError("URL failed to launch");
|
|
||||||
}
|
}
|
||||||
});
|
|
||||||
return retval;
|
auto uri = ref new Windows::Foundation::Uri(wurl);
|
||||||
|
SDL_free(wurl);
|
||||||
|
launchUriOperation(Windows::System::Launcher::LaunchUriAsync(uri));
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* vi: set ts=4 sw=4 expandtab: */
|
/* vi: set ts=4 sw=4 expandtab: */
|
||||||
|
Loading…
Reference in New Issue
Block a user