Commandline options changed:

-datapath is now named -datadir to match the internal variables again.
        Added -help to show all possible command line options.


git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@383 4a71c877-e1ca-e34f-864e-861f7616d084
master
Dennis Schridde 2006-01-15 12:43:16 +00:00
parent d97c39b407
commit a166a71cc9
3 changed files with 23 additions and 10 deletions

View File

@ -33,6 +33,7 @@ BOOL scanGameSpyFlags(LPSTR gflag,LPSTR value);
extern char SaveGamePath[];
// Got removed by Dennis
//extern char default_data_path[MAX_PATH]; // from main.c (yes, I know, more globals - Per)
extern char datadir[MAX_PATH];
// whether to play the intro video
BOOL clIntroVideo;
@ -51,7 +52,18 @@ BOOL ParseCommandLineEarly(int argc, char** argv)
for (i = 1; i < argc; ++i) {
tokenType = argv[i];
if (stricmp(tokenType, "-debugfile") == 0) {
// TODO: Support --GNU long-opts and -G short opts
if( stricmp(tokenType, "-help" ) == 0 ) {
// Show help
fprintf( stdout,
"Warzone command line options:\n"
" -help : Show this help\n"
" -debug FLAGS : Show debug for FLAGS\n"
" -debugfile FILE : Log debug output in FILE\n"
" -datadir DIR : Set default datadir to DIR\n" );
return FALSE;
}
else if (stricmp(tokenType, "-debugfile") == 0) {
// find the file name
token = argv[++i];
if (token == NULL) {
@ -70,17 +82,16 @@ BOOL ParseCommandLineEarly(int argc, char** argv)
debug(LOG_ERROR, "Debug flag \"%s\" not found!", token);
return FALSE;
}
// Removed by Dennis... Shall we update to the new system?
/* } else if (stricmp(tokenType, "-datapath") == 0) {
} else if (stricmp(tokenType, "-datadir") == 0) {
// find the quoted path name
token = argv[++i];
if (token == NULL)
{
DBERROR( ("Unrecognised datapath\n") );
DBERROR( ("Unrecognised datadir\n") );
return FALSE;
}
strncpy(default_data_path, token, sizeof(default_data_path));
*/ }
strncpy(datadir, token, sizeof(datadir));
}
}
return TRUE;
}

View File

@ -41,6 +41,7 @@
#ifndef DEFAULT_DATA_DIR
#define DEFAULT_DATA_DIR "/usr/share"
#endif
char datadir[MAX_PATH]; // Global that src/clparse.c:ParseCommandLineEarly can write to, so it can override the default datadir on runtime
// Warzone 2100 . Pumpkin Studios
@ -96,7 +97,7 @@ static void initialize_PhysicsFS(char *mod)
PHYSFS_Version compiled;
PHYSFS_Version linked;
char **i;
char datadir[MAX_PATH], overridepath[MAX_PATH], modpath[MAX_PATH], writepath[MAX_PATH], mappath[MAX_PATH];
char overridepath[MAX_PATH], modpath[MAX_PATH], writepath[MAX_PATH], mappath[MAX_PATH];
#ifdef WIN32
const char *writedir = "warzone-2.0";
#else
@ -126,9 +127,10 @@ static void initialize_PhysicsFS(char *mod)
}
PHYSFS_addToSearchPath(writepath, 0); /* add to search path */
strcpy( datadir, DEFAULT_DATA_DIR );
if( !*datadir )
strcpy( datadir, DEFAULT_DATA_DIR );
strcat( datadir, "/warzone/warzone.wz" );
debug( LOG_WZ, "Trying Datadir: %s\n", datadir );
debug( LOG_WZ, "Trying default datadir: %s\n", datadir );
if ( !PHYSFS_addToSearchPath( datadir, 1) )
{
debug( LOG_WZ, "Could not find data in \"%s\".", datadir );

View File

@ -1 +1 @@
#define SVN_REVISION "Revision 21M"
#define SVN_REVISION "Revision 22:23M"