Esempio n. 1
0
/**
 * @brief Open URL in system browser
 * @param[in] url    URL to open
 * @param     doexit Quit from game after opening URL
 */
void Sys_OpenURL(const char *url, qboolean doexit)
{
#ifndef DEDICATED
	char fn[MAX_OSPATH];
	char cmdline[MAX_CMD];

	static qboolean doexit_spamguard = qfalse;

	if (doexit_spamguard)
	{
		Com_DPrintf("Sys_OpenURL: already in a doexit sequence, ignoring %s\n", url);
		return;
	}

	Com_Printf("Open URL: %s\n", url);

	Com_DPrintf("URL script: %s\n", fn);

#ifdef __APPLE__
	Com_sprintf(cmdline, MAX_CMD, "open '%s' &", url);
#else
	Com_sprintf(cmdline, MAX_CMD, "xdg-open '%s' &", url);
#endif

	Sys_StartProcess(cmdline, doexit);

	Cbuf_ExecuteText(EXEC_NOW, "minimize");
#endif // not DEDICATED
}
Esempio n. 2
0
/*
=================
Sys_OpenURL
=================
*/
void Sys_OpenURL( const char *url, qboolean doexit ) {
	char *basepath, *homepath, *pwdpath;
	char fname[20];
	char fn[MAX_OSPATH];
	char cmdline[MAX_CMD];

	static qboolean doexit_spamguard = qfalse;

	if ( doexit_spamguard ) {
		Com_DPrintf( "Sys_OpenURL: already in a doexit sequence, ignoring %s\n", url );
		return;
	}

	Com_Printf( "Open URL: %s\n", url );
	// opening an URL on *nix can mean a lot of things ..
	// just spawn a script instead of deciding for the user :-)

	// do the setup before we fork
	// search for an openurl.sh script
	// search procedure taken from Sys_LoadDll
	Q_strncpyz( fname, "openurl.sh", 20 );

	pwdpath = Sys_Cwd();
	Com_sprintf( fn, MAX_OSPATH, "%s/%s", pwdpath, fname );
	if ( access( fn, X_OK ) == -1 ) {
		Com_DPrintf( "%s not found\n", fn );
		// try in home path
		homepath = Cvar_VariableString( "fs_homepath" );
		Com_sprintf( fn, MAX_OSPATH, "%s/%s", homepath, fname );
		if ( access( fn, X_OK ) == -1 ) {
			Com_DPrintf( "%s not found\n", fn );
			// basepath, last resort
			basepath = Cvar_VariableString( "fs_basepath" );
			Com_sprintf( fn, MAX_OSPATH, "%s/%s", basepath, fname );
			if ( access( fn, X_OK ) == -1 ) {
				Com_DPrintf( "%s not found\n", fn );
				Com_Printf( "Can't find script '%s' to open requested URL (use +set developer 1 for more verbosity)\n", fname );
				// we won't quit
				return;
			}
		}
	}

	// show_bug.cgi?id=612
	if ( doexit ) {
		doexit_spamguard = qtrue;
	}

	Com_DPrintf( "URL script: %s\n", fn );

	// build the command line
	Com_sprintf( cmdline, MAX_CMD, "%s '%s' &", fn, url );

	Sys_StartProcess( cmdline, doexit );

}
Esempio n. 3
0
void Sys_OpenURL(const char *url, qboolean doexit)
{
	char fname[20], fn[MAX_OSPATH];
	char cmdline[MAX_CMD], *basename[3];
	int i, r;

	static qboolean doexit_spamguard = qfalse;

// XXX: UrtDevs: disabled until it matures (possible security risks)
	return;
//////////////////////////
	if(doexit_spamguard) {
		Com_DPrintf("Sys_OpenURL: already in a doexit sequence, ignoring %s\n", url);
		return;
	}

	Com_Printf("Open URL: %s\n", url);

	basename[0] = Sys_Cwd();
	basename[1] = Cvar_VariableString("fs_homepath");
	basename[2] = Cvar_VariableString("fs_basepath");

	for(i = 0; i < 3; i++) {
		Com_sprintf(fn, MAX_OSPATH, "%s/%s", basename[i], fname);
		r = access(fn, X_OK);

		if(r != -1) break;
	}

	if(r == -1) {
		Com_DPrintf("%s not found\n", fn);
		Com_Printf("Can't find script '%s' to open requested URL (use +set developer 1 for more verbosity)\n", fname);
		return;
	}

	if(doexit) doexit_spamguard = qtrue;

	Com_DPrintf("URL script: %s\n", fn);
	
	Com_sprintf(cmdline, MAX_CMD, "%s '%s' &", fn, url);
	Sys_StartProcess(cmdline, doexit);
}
Esempio n. 4
0
/**
 * @brief Open URL in system browser
 * @param[in] url    URL to open
 * @param     doexit Quit from game after opening URL
 */
void Sys_OpenURL(const char *url, qboolean doexit)
{
#ifndef DEDICATED
#ifndef __AROS__
	char fn[MAX_OSPATH];
	char cmdline[MAX_CMD];
#endif

	static qboolean doexit_spamguard = qfalse;

	if (doexit_spamguard)
	{
		Com_DPrintf("Sys_OpenURL: already in a doexit sequence, ignoring %s\n", url);
		return;
	}

	Com_Printf("Open URL: %s\n", url);

#ifndef __AROS__
	Com_DPrintf("URL script: %s\n", fn);

#ifdef __APPLE__
	Com_sprintf(cmdline, MAX_CMD, "open '%s' &", url);
#else
	Com_sprintf(cmdline, MAX_CMD, "xdg-open '%s' &", url);
#endif

	Sys_StartProcess(cmdline, doexit);
#else
	if ((OpenURLBase = OpenLibrary("openurl.library", 1)))
	{
		URL_Open(url, TAG_DONE);
		CloseLibrary(OpenURLBase);
	}
#endif

	SDL_WM_IconifyWindow();
#endif
}
Esempio n. 5
0
void Sys_ReplaceProcess( char *cmdline ) {

	Sys_StartProcess( cmdline, qtrue );
}
Esempio n. 6
0
void Sys_DoStartProcess( char *cmdline ) {

	Sys_StartProcess( cmdline, qfalse );
}