How do I get the path to the game directory?

Phloxicon

Newbie
Joined
Mar 26, 2009
Messages
17
Reaction score
0
I just want to be able to do something along the lines of:
openFile( PATH_TO_FILE, "/test/test.file" );

It's figuring out how to get PATH_TO_FILE that's stopping me. What's the call for this?

Thanks :)
 
Found it here:
http://fr.pastebin.ca/raw/971440

Code:
bool RunLuaFile( const char* scriptname )
{
	char char_filename[ _MAX_PATH ];
	char char_output_full_filename[ _MAX_PATH ];

	strcpy( char_filename, scriptname );
	filesystem->RelativePathToFullPath( char_filename, "MOD", char_output_full_filename, sizeof( char_output_full_filename ));

	const char *constcharpointer = reinterpret_cast<const char *>( char_output_full_filename );
	Msg( "constcharpointer = %s\n", constcharpointer );
	if ( !filesystem->FileExists( constcharpointer ))
	{
		//cvar->ConsoleColorPrintf( LUA_ERROR_PRINT_COLOUR, "[Lua] IFileSystem Cannot find the file: %s\n", constcharpointer );
		Warning( "\nFile doesn't exist\n" );
		return false;
	}

	return true;
}
 
Back
Top