diff -rwc SDL2-2.0.3_orgg/include/SDL_filesystem.h SDL2-2.0.3_Modified/include/SDL_filesystem.h *** SDL2-2.0.3_orgg/include/SDL_filesystem.h 2014-03-15 19:31:42.000000000 +0530 --- SDL2-2.0.3_Modified/include/SDL_filesystem.h 2015-06-18 12:11:04.823287900 +0530 *************** *** 125,130 **** --- 125,140 ---- */ extern DECLSPEC char *SDLCALL SDL_GetPrefPath(const char *org, const char *app); + /** + * \brief Open an URL in a default web browser + * It can also be used to execute a binary, open a file or directory + * + * \param url The URL to open (ex: "http://www.libsdl.org") + * + * \return 0 on success, -1 on error + */ + extern DECLSPEC int SDLCALL SDL_OpenURL(const char *url); + /* Ends C function definitions when using C++ */ #ifdef __cplusplus } diff -rwc SDL2-2.0.3_orgg/src/dynapi/SDL_dynapi_overrides.h SDL2-2.0.3_Modified/src/dynapi/SDL_dynapi_overrides.h *** SDL2-2.0.3_orgg/src/dynapi/SDL_dynapi_overrides.h 2014-03-15 19:31:44.000000000 +0530 --- SDL2-2.0.3_Modified/src/dynapi/SDL_dynapi_overrides.h 2015-06-18 12:07:45.768287900 +0530 *************** *** 575,577 **** --- 575,578 ---- #define SDL_GetDefaultAssertionHandler SDL_GetDefaultAssertionHandler_REAL #define SDL_GetAssertionHandler SDL_GetAssertionHandler_REAL #define SDL_DXGIGetOutputInfo SDL_DXGIGetOutputInfo_REAL + #define SDL_OpenURL SDL_OpenURL_REAL diff -rwc SDL2-2.0.3_orgg/src/dynapi/SDL_dynapi_procs.h SDL2-2.0.3_Modified/src/dynapi/SDL_dynapi_procs.h *** SDL2-2.0.3_orgg/src/dynapi/SDL_dynapi_procs.h 2014-03-15 19:31:44.000000000 +0530 --- SDL2-2.0.3_Modified/src/dynapi/SDL_dynapi_procs.h 2015-06-17 17:58:32.728564500 +0530 *************** *** 606,608 **** --- 606,609 ---- #ifdef __WIN32__ SDL_DYNAPI_PROC(void,SDL_DXGIGetOutputInfo,(int a,int *b, int *c),(a,b,c),) #endif + SDL_DYNAPI_PROC(int,SDL_OpenURL,(const char *a),(a),return) diff -rwc SDL2-2.0.3_orgg/src/filesystem/windows/SDL_sysfilesystem.c SDL2-2.0.3_Modified/src/filesystem/windows/SDL_sysfilesystem.c *** SDL2-2.0.3_orgg/src/filesystem/windows/SDL_sysfilesystem.c 2014-03-15 19:31:42.000000000 +0530 --- SDL2-2.0.3_Modified/src/filesystem/windows/SDL_sysfilesystem.c 2015-06-17 18:42:02.659131800 +0530 *************** *** 27,33 **** #include "../../core/windows/SDL_windows.h" #include ! #include "SDL_assert.h" #include "SDL_error.h" #include "SDL_stdinc.h" --- 27,33 ---- #include "../../core/windows/SDL_windows.h" #include ! #include #include "SDL_assert.h" #include "SDL_error.h" #include "SDL_stdinc.h" *************** *** 135,140 **** --- 135,171 ---- return retval; } + + int + SDLCALL SDL_OpenURL(const char *url) + { + WCHAR* wurl = NULL; + int ret_val = -1; + if (url == NULL) { + return SDL_InvalidParamError(url); + } + + wurl = WIN_UTF8ToString(url); + if (wurl == NULL) { + SDL_OutOfMemory(); + return ret_val; + } + + /* For successfull execution it returns value greater than 32 + * <= 32 are various error condition + * https://msdn.microsoft.com/en-us/library/windows/desktop/bb762153%28v=vs.85%29.aspx + */ + ret_val = (int)ShellExecuteW(NULL, L"open", wurl, NULL, NULL, SW_SHOWNORMAL); + if (ret_val > 32){ + ret_val = 0; + } + else{ + ret_val = -1; + WIN_SetError("Couldn't open given url."); + } + SDL_free(wurl); + return ret_val; + } #endif /* SDL_FILESYSTEM_WINDOWS */ /* vi: set ts=4 sw=4 expandtab: */