当前位置: 首页>>代码示例>>C++>>正文


C++ Sys_Cwd函数代码示例

本文整理汇总了C++中Sys_Cwd函数的典型用法代码示例。如果您正苦于以下问题:C++ Sys_Cwd函数的具体用法?C++ Sys_Cwd怎么用?C++ Sys_Cwd使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了Sys_Cwd函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: Sys_SaveFileCodes

bool Sys_SaveFileCodes(void)
{
	bool ret;
	int res;

	// get the number of files
	int count;
	count = _buildFileList(Sys_Cwd(), false, false);

	// open a file for writing
	FILE* out;
	out = fopen("d:\\xbx_filelist","wb");
	if(!out)
	{
		return false;
	}

	// allocate a buffer for writing
	byte*	baseAddr;
	int		bufferSize;
	
	bufferSize	= sizeof(int) + ( count * ( 2 * sizeof(int) + MAX_OSPATH ) );
	baseAddr	= (byte*)Z_Malloc(bufferSize,TAG_TEMP_WORKSPACE,qtrue,32);
	buffer		= baseAddr;

	// write the number of files to the buffer
	*(int*)buffer	=  count;
	buffer			+= sizeof(count);

	// fill up the rest of the buffer
	ret = _buildFileList(Sys_Cwd(), false, true);

	if(!ret)
	{
		// there was a problem
		fclose(out);
		Z_Free(baseAddr);
		return false;
	}

	// attempt to write out the data
	if(!(fwrite(baseAddr,bufferSize,1,out)))
	{
		// there was a problem
		fclose(out);
		Z_Free(baseAddr);
		return false;
	}

	// everything went ok
	fclose(out);
	Z_Free(baseAddr);
	return true;
}
开发者ID:Hasimir,项目名称:jedi-academy-1,代码行数:54,代码来源:win_filecode.cpp

示例2: Q_strcat

char *Sys_DefaultInstallPath( char * buffer, int size )
{
#ifdef USE_BOOTWITHNOFILES
	if( SHGetSpecialFolderPath( NULL, buffer, CSIDL_COMMON_APPDATA, TRUE ) != NOERROR )
	{
		Q_strcat( buffer, size, "\\HermitWorks\\SpaceTrader" );
		return buffer;
	}

	return Sys_Cwd( buffer, size );
#else
	return Sys_Cwd( buffer, size );
#endif
}
开发者ID:ballju,项目名称:SpaceTrader-GPL-1.1.14,代码行数:14,代码来源:win_shared.c

示例3: Sys_Cwd

/*
=================
Sys_DefaultLibPath
=================
*/
char *Sys_DefaultLibPath(void) {
	if (*libPath) {
		return libPath;
	} else {
		return Sys_Cwd();
	}
}
开发者ID:DerSaidin,项目名称:OpenWolf,代码行数:12,代码来源:sys_main.cpp

示例4: Com_sprintf

/*
=================
Sys_DefaultInstallPath
=================
*/
char *Sys_DefaultInstallPath(void) {
	static char installdir[MAX_OSPATH];

	Com_sprintf(installdir, sizeof(installdir), "%s", Sys_Cwd());

	Q_strreplace(installdir, sizeof(installdir), "bin32", "");
	Q_strreplace(installdir, sizeof(installdir), "bin64", "");

	Q_strreplace(installdir, sizeof(installdir), "src/engine", "");
	Q_strreplace(installdir, sizeof(installdir), "src\\engine", "");
	
	Q_strreplace(installdir, sizeof(installdir), "bin/win32", "");
	Q_strreplace(installdir, sizeof(installdir), "bin\\win32", "");
	
	Q_strreplace(installdir, sizeof(installdir), "bin/win64", "");
	Q_strreplace(installdir, sizeof(installdir), "bin\\win64", "");
	
	Q_strreplace(installdir, sizeof(installdir), "bin/linux-x86", "");
	Q_strreplace(installdir, sizeof(installdir), "bin/linux-x86_64", "");

	Q_strreplace(installdir, sizeof(installdir), "bin/freebsd-i386", "");
	Q_strreplace(installdir, sizeof(installdir), "bin/freebsd-amd64", "");
	
	// MacOS X x86 and x64
	Q_strreplace(installdir, sizeof(installdir), "bin/macosx", "");	

	return installdir;
}
开发者ID:DerSaidin,项目名称:OpenWolf,代码行数:33,代码来源:sys_main.cpp

示例5: Sys_Cwd

char *Sys_DefaultCDPath(void)
{
	if (*programpath)
		return programpath;
	else
		return Sys_Cwd();
}
开发者ID:Camron,项目名称:OpenJK,代码行数:7,代码来源:unix_shared.c

示例6: Sys_Cwd

char *Sys_DefaultInstallPath( void ) {
	if ( *installPath ) {
		return installPath;
	} else {
		return Sys_Cwd();
	}
}
开发者ID:ptitSeb,项目名称:RtCW-OpenPandora,代码行数:7,代码来源:unix_shared.c

示例7: Sys_Cwd

char *Sys_DefaultInstallPath(void)
{
	if (*installPath)
		return installPath;
	else
		return Sys_Cwd();
}
开发者ID:blackberry,项目名称:Quake3,代码行数:7,代码来源:unix_shared.c

示例8: Sys_OpenURL

/*
=================
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 );

}
开发者ID:DerSaidin,项目名称:OpenWolf,代码行数:61,代码来源:sys_unix.cpp

示例9: intptr_t

/*
=================
Sys_LoadDll

Used to load a development dll instead of a virtual machine
#1 look down current path
#2 look in fs_homepath
#3 look in fs_basepath
=================
*/
void *Sys_LoadDll( const char *name, char *fqpath ,
	intptr_t (**entryPoint)(int, ...),
	intptr_t (*systemcalls)(intptr_t, ...) )
{
	void  *libHandle;
	void  (*dllEntry)( intptr_t (*syscallptr)(intptr_t, ...) );
	char  fname[MAX_OSPATH];
	char  *basepath;
	char  *homepath;
	char  *pwdpath;
	char  *gamedir;

	assert( name );

	Q_snprintf (fname, sizeof(fname), "%s" ARCH_STRING DLL_EXT, name);

	// TODO: use fs_searchpaths from files.c
	pwdpath = Sys_Cwd();
	basepath = Cvar_VariableString( "fs_basepath" );
	homepath = Cvar_VariableString( "fs_homepath" );
	gamedir = Cvar_VariableString( "fs_game" );

	libHandle = Sys_TryLibraryLoad(pwdpath, gamedir, fname, fqpath);

	if(!libHandle && homepath)
		libHandle = Sys_TryLibraryLoad(homepath, gamedir, fname, fqpath);

	if(!libHandle && basepath)
		libHandle = Sys_TryLibraryLoad(basepath, gamedir, fname, fqpath);

	if(!libHandle) {
		Com_Printf ( "Sys_LoadDll(%s) failed to load library\n", name );
		return NULL;
	}

	dllEntry = Sys_LoadFunction( libHandle, "dllEntry" );
	*entryPoint = Sys_LoadFunction( libHandle, "vmMain" );

	if ( !*entryPoint || !dllEntry )
	{
		Com_Printf ( "Sys_LoadDll(%s) failed to find vmMain function:\n\"%s\" !\n", name, Sys_LibraryError( ) );
		Sys_UnloadLibrary(libHandle);

		return NULL;
	}

	Com_Printf ( "Sys_LoadDll(%s) found vmMain function at %p\n", name, *entryPoint );
	dllEntry( systemcalls );

	return libHandle;
}
开发者ID:lally,项目名称:ioquake,代码行数:61,代码来源:sys_main.c

示例10: Sys_OpenURL

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);
}
开发者ID:b1naryth1ef,项目名称:B1nUrT,代码行数:42,代码来源:sys_unix.c

示例11: JVM_JNI_Init

static qboolean JVM_JNI_Init()
{
	if(javaLib)
		return qtrue;

	Com_Printf("Loading \"%s\"...\n", jvm_javaLib->string);
	if((javaLib = Sys_LoadLibrary(jvm_javaLib->string)) == 0)
	{
#ifdef _WIN32
		return qfalse;
#else
		char            fn[1024];

		Com_Printf("JVM_JNI_Init() failed:\n\"%s\"\n", Sys_LibraryError());

		Q_strncpyz(fn, Sys_Cwd(), sizeof(fn));
		strncat(fn, "/", sizeof(fn) - strlen(fn) - 1);
		strncat(fn, jvm_javaLib->string, sizeof(fn) - strlen(fn) - 1);

		if((javaLib = Sys_LoadLibrary(fn)) == 0)
		{
			Com_Printf("JVM_JNI_Init() failed:\n\"%s\"\n", Sys_LibraryError());
			return qfalse;
		}
#endif							/* _WIN32 */
	}

	javaEnabled = qtrue;

	QJNI_CreateJavaVM = GPA("JNI_CreateJavaVM");
	QJNI_GetCreatedJavaVMs = GPA("JNI_GetCreatedJavaVMs");

	if(!javaEnabled)
	{
		//JVM_JNI_Shutdown();
		return qfalse;
	}

	return qtrue;
}
开发者ID:redrumrobot,项目名称:dretchstorm,代码行数:40,代码来源:vm_java.c

示例12: int

void *Sys_LoadDll( const char *name, char *fqpath,
				   int( **entryPoint ) ( int, ... ),
				   int ( *systemcalls )( int, ... ) ) {
	void *libHandle;
	void ( *dllEntry )( int ( *syscallptr )( int, ... ) );
	char fname[MAX_OSPATH];
	char  *pwdpath;
	char  *homepath;
	char  *basepath;
	char  *gamedir;
	char  *fn;
	const char*  err = NULL; // bk001206 // rb0101023 - now const
#if !defined( DEDICATED )
	char *cvar_name = NULL;
#endif

	*fqpath = 0 ;       // added 2/15/02 by T.Ray

	// bk001206 - let's have some paranoia
	assert( name );

	Q_strncpyz( fname, Sys_GetDLLName( name ), sizeof( fname ) );

// bk001129 - was RTLD_LAZY
#define Q_RTLD    RTLD_NOW

	pwdpath = Sys_Cwd();
	homepath = Cvar_VariableString( "fs_homepath" );
	basepath = Cvar_VariableString( "fs_basepath" );
	gamedir = Cvar_VariableString( "fs_game" );

	// this is relevant to client only
	// this code is in for full client hosting a game, but it's not affected by it
#if !defined( DEDICATED )
	// do a first scan to identify what we are going to dlopen
	// we need to pass this to FS_ExtractFromPakFile so that it checksums the right file
	// NOTE: if something fails (not found, or file operation failed), we will ERR_FATAL (in the checksum itself, we only ERR_DROP)
#ifndef NDEBUG
	fn = FS_BuildOSPath( pwdpath, gamedir, fname );
	if ( access( fn, R_OK ) == -1 ) {
#endif
	fn = FS_BuildOSPath( homepath, gamedir, fname );
	if ( access( fn, R_OK ) == 0 ) {
		// there is a .so in fs_homepath, but is it a valid one version-wise?
		// we use a persistent variable in config.cfg to make sure
		// this is set in FS_CL_ExtractFromPakFile when the file is extracted
		cvar_t *lastVersion;
		cvar_name = va( "cl_lastVersion%s", name );
		lastVersion = Cvar_Get( cvar_name, "(uninitialized)", CVAR_ARCHIVE );
		if ( Q_stricmp( Cvar_VariableString( "version" ), lastVersion->string ) ) {
			Com_DPrintf( "clearing non matching version of %s .so: %s\n", name, fn );
			if ( remove( fn ) == -1 ) {
				Com_Error( ERR_FATAL, "failed to remove outdated '%s' file:\n\"%s\"\n", fn, strerror( errno ) );
			}
			// we cancelled fs_homepath, go work on basepath now
			fn = FS_BuildOSPath( basepath, gamedir, fname );
			if ( access( fn, R_OK ) == -1 ) {
				// we may be dealing with a media-only mod, check wether we can find 'reference' DLLs and copy them over
				if ( !CopyDLLForMod( &fn, gamedir, pwdpath, homepath, basepath, fname ) ) {
					Com_Error( ERR_FATAL, "Sys_LoadDll(%s) failed, no corresponding .so file found in fs_homepath or fs_basepath\n", name );
				}
			}
		}
		// the .so in fs_homepath is valid version-wise .. FS_CL_ExtractFromPakFile will have to decide wether it's valid pk3-wise later
	} else {
		fn = FS_BuildOSPath( basepath, gamedir, fname );
		if ( access( fn, R_OK ) == -1 ) {
			// we may be dealing with a media-only mod, check wether we can find 'reference' DLLs and copy them over
			if ( !CopyDLLForMod( &fn, gamedir, pwdpath, homepath, basepath, fname ) ) {
				Com_Error( ERR_FATAL, "Sys_LoadDll(%s) failed, no corresponding .so file found in fs_homepath or fs_basepath\n", name );
			}
		}
	}
#ifndef NDEBUG
}
#endif

	// NERVE - SMF - extract dlls from pak file for security
	// we have to handle the game dll a little differently
	// NOTE #2: we may have found a file in fs_basepath, and if the checksum is wrong, FS_Extract will write in fs_homepath
	//   won't be a problem since we start a brand new scan next
	if ( cl_connectedToPureServer && Q_strncmp( name, "qagame", 6 ) ) {
		if ( !FS_CL_ExtractFromPakFile( fn, gamedir, fname, cvar_name ) ) {
			Com_Error( ERR_DROP, "Game code(%s) failed Pure Server check", fname );
		}
	}
#endif

#ifndef NDEBUG
	// current directory
	// NOTE: only for debug build, see Sys_LoadDll discussion
	fn = FS_BuildOSPath( pwdpath, gamedir, fname );
	Com_Printf( "Sys_LoadDll(%s)... ", fn );
	libHandle = dlopen( fn, Q_RTLD );

	if ( !libHandle ) {
		Com_Printf( "\nSys_LoadDll(%s) failed:\n\"%s\"\n", fn, dlerror() );
#endif

	// homepath
//.........这里部分代码省略.........
开发者ID:chegestar,项目名称:omni-bot,代码行数:101,代码来源:unix_main.c

示例13: Sys_Cwd

/*
==============
Sys_DefaultBasePath
==============
*/
char *Sys_DefaultBasePath( void ) {
	return Sys_Cwd();
}
开发者ID:Agustinlv,项目名称:BlueHarvest,代码行数:8,代码来源:win_main.cpp

示例14: Sys_Cwd

char *Sys_DefaultInstallPath(void)
{
	return Sys_Cwd();
}
开发者ID:themuffinator,项目名称:fnq3,代码行数:4,代码来源:win_shared.c

示例15: Sys_Cwd

/*
==============
Sys_DefaultCDPath
==============
*/
char *Sys_DefaultCDPath( void ) {
    return Sys_Cwd();
}
开发者ID:Jsoucek,项目名称:q3ce,代码行数:8,代码来源:q3ce_main.cpp


注:本文中的Sys_Cwd函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。