]> icculus.org git repositories - taylor/freespace2.git/blob - src/platform/win.cpp
fix issue with looping audio streams
[taylor/freespace2.git] / src / platform / win.cpp
1 /*
2  * Copyright (C) Volition, Inc. 1999.  All rights reserved.
3  *
4  * All source code herein is the property of Volition, Inc. You may not sell
5  * or otherwise commercially exploit the source or things you created based on
6  * the source.
7  */
8
9 #ifndef PLAT_UNIX
10
11 #define WIN32_LEAN_AND_MEAN
12 #include <windows.h>
13 #include <shellapi.h>
14
15 #include "SDL.h"
16 #include "osapi.h"
17
18
19 int platform_open_url(const char *url)
20 {
21         char s_url[256];
22
23         // make sure it's a valid www address
24         if ( !SDL_strncasecmp(url, "http://", 7) || !SDL_strncasecmp(url, "https://", 8) ) {
25                 SDL_strlcpy(s_url, url, SDL_arraysize(s_url));
26         } else {
27                 SDL_snprintf(s_url, SDL_arraysize(s_url), "http://%s", url);
28         }
29
30         int rval = (int) ShellExecuteA(NULL, "open", s_url, NULL, NULL, SW_SHOWNORMAL);
31
32         if (rval <= 32) {
33                 return -1;
34         }
35
36         return 0;
37 }
38
39 #endif