url: Another attempt at WinRT implementation.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
diff --git a/src/misc/winrt/SDL_sysurl.cpp b/src/misc/winrt/SDL_sysurl.cpp
index a2c0fc6..f1314e9 100644
--- a/src/misc/winrt/SDL_sysurl.cpp
+++ b/src/misc/winrt/SDL_sysurl.cpp
@@ -21,22 +21,21 @@
#include <Windows.h>
+#include "../../core/windows/SDL_windows.h"
#include "../SDL_sysurl.h"
int
SDL_SYS_OpenURL(const char *url)
{
- auto uri = ref new Windows::Foundation::Uri(url);
- concurrency::task<bool> launchUriOperation(Windows::System::Launcher::LaunchUriAsync(uri));
- int retval = -1;
- launchUriOperation.then([](bool success) {
- if (success) {
- retval = 0;
- } else {
- retval = SDL_SetError("URL failed to launch");
- }
- });
- return retval;
+ WCHAR *wurl = WIN_UTF8ToString(url);
+ if (wurl == NULL) {
+ return SDL_OutOfMemory();
+ }
+
+ 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: */