From: Patrick H. <ac...@us...> - 2004-08-30 03:31:04
|
Update of /cvsroot/vegastrike/vegastrike/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2098/src Modified Files: vsfilesystem.cpp Log Message: made it look for Version.txt Index: vsfilesystem.cpp =================================================================== RCS file: /cvsroot/vegastrike/vegastrike/src/vsfilesystem.cpp,v retrieving revision 1.36 retrieving revision 1.37 diff -C2 -r1.36 -r1.37 *** vsfilesystem.cpp 26 Jul 2004 07:19:20 -0000 1.36 --- vsfilesystem.cpp 30 Aug 2004 03:30:54 -0000 1.37 *************** *** 436,442 **** homedir = user_home_path+"/"+HOMESUBDIR; #else ! homedir = datadir+"/.vegastrike"; #endif ! cerr<<"USING HOMEDIR : "<<homedir<<endl; CreateDirectoryAbs( homedir); } --- 436,442 ---- homedir = user_home_path+"/"+HOMESUBDIR; #else ! homedir = datadir+"/"+HOMESUBDIR; #endif ! cerr<<"USING HOMEDIR : "<<homedir<< " As the home directory "<<endl; CreateDirectoryAbs( homedir); } *************** *** 470,474 **** data_paths.push_back( "/usr/games/vegastrike/data4.x"); data_paths.push_back( "/opt/share/vegastrike/data4.x"); ! // Win32 data should be "." char tmppath[16384]; --- 470,474 ---- data_paths.push_back( "/usr/games/vegastrike/data4.x"); data_paths.push_back( "/opt/share/vegastrike/data4.x"); ! // Win32 data should be "." char tmppath[16384]; *************** *** 498,510 **** } data_paths.clear(); ! // Load default VS config file char * conffile = new char[config_file.length()+1]; conffile[config_file.length()] = 0; memcpy( conffile, config_file.c_str(), config_file.length()); - vs_config = createVegaConfig( conffile); - delete []conffile; // Get the mods path ! moddir = vs_config->getVariable( "data", "modpath", datadir+"/"+string( "mods")); cout<<"Found MODDIR = "<<moddir<<endl; } --- 498,531 ---- } data_paths.clear(); ! string versionloc=datadir+"/Version.txt"; ! FILE * version = fopen (versionloc.c_str(),"r"); ! if (!version) { ! versionloc=datadir+"Version.txt"; ! version=fopen(versionloc.c_str(),"r"); ! } ! if (!version) { ! version=fopen("Version.txt","r"); ! } ! if (version) { ! string hsd=""; ! int c; ! while ((c=fgetc(version))!=EOF) { ! if (isspace(c)) ! break; ! hsd+=(char)c; ! } ! fclose(version); ! if (hsd.length()) { ! HOMESUBDIR=hsd; ! printf ("Using %s as the home directory\n",hsd.c_str()); ! } ! } ! // Load default VS config file char * conffile = new char[config_file.length()+1]; conffile[config_file.length()] = 0; memcpy( conffile, config_file.c_str(), config_file.length()); // Get the mods path ! moddir = datadir+"/"+string( "mods"); cout<<"Found MODDIR = "<<moddir<<endl; } *************** *** 606,611 **** // Delete the default config in order to reallocate it with the right one (if it is a mod) ! delete vs_config; ! vs_config=NULL; char * conffile = new char[config_file.length()+1]; conffile[config_file.length()] = 0; --- 627,635 ---- // Delete the default config in order to reallocate it with the right one (if it is a mod) ! if (vs_config) { ! fprintf (stderr,"reallocating vs_config \n"); ! delete vs_config; ! } ! vs_config=NULL; char * conffile = new char[config_file.length()+1]; conffile[config_file.length()] = 0; |