Skip to content

Commit

Permalink
url: Another attempt at WinRT implementation.
Browse files Browse the repository at this point in the history
  • Loading branch information
icculus committed Oct 5, 2020
1 parent 1f4b5d5 commit 02addf1
Showing 1 changed file with 10 additions and 11 deletions.
21 changes: 10 additions & 11 deletions src/misc/winrt/SDL_sysurl.cpp
Expand Up @@ -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: */
Expand Down

0 comments on commit 02addf1

Please sign in to comment.