From: Steve A. <ste...@us...> - 2004-08-17 01:19:44
|
Update of /cvsroot/stella/stella/src/unix In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9317/src/unix Modified Files: SettingsUNIX.cxx Log Message: Fixed a bug reported by D. Baron whereby the /etc/stella.pro file wasn't used even when it should have been. OSX and Windows users would never see this, since those ports don't (yet) have any concept of user vs. system files. The OSX and Windows ports will have to be updated though, because of changes in the Settings class. Changed the code in SettingsUNIX::fileExists() to only check for the existence of a file, not whether you can write to it. This is what the name implies. Bumped the version number to 1.4.2_cvs. Index: SettingsUNIX.cxx =================================================================== RCS file: /cvsroot/stella/stella/src/unix/SettingsUNIX.cxx,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** SettingsUNIX.cxx 5 Jul 2004 00:53:48 -0000 1.6 --- SettingsUNIX.cxx 17 Aug 2004 01:17:08 -0000 1.7 *************** *** 43,60 **** mkdir(myStateDir.c_str(), 0777); ! myUserPropertiesFile = stelladir + "/stella.pro"; ! mySystemPropertiesFile = "/etc/stella.pro"; ! myUserConfigFile = stelladir + "/stellarc"; ! mySystemConfigFile = "/etc/stellarc"; // Set up the names of the input and output config files ! mySettingsOutputFilename = myUserConfigFile; ! if(fileExists(myUserConfigFile)) ! mySettingsInputFilename = myUserConfigFile; else ! mySettingsInputFilename = mySystemConfigFile; ! mySnapshotFile = ""; ! myStateFile = ""; } --- 43,68 ---- mkdir(myStateDir.c_str(), 0777); ! string userPropertiesFile = stelladir + "/stella.pro"; ! string systemPropertiesFile = "/etc/stella.pro"; ! string userConfigFile = stelladir + "/stellarc"; ! string systemConfigFile = "/etc/stellarc"; // Set up the names of the input and output config files ! myConfigOutputFile = userConfigFile; ! if(fileExists(userConfigFile)) ! myConfigInputFile = userConfigFile; ! else if(fileExists(systemConfigFile)) ! myConfigInputFile = systemConfigFile; else ! myConfigInputFile = ""; ! // Set up the input and output properties files ! myPropertiesOutputFile = userPropertiesFile; ! if(fileExists(userPropertiesFile)) ! myPropertiesInputFile = userPropertiesFile; ! else if(fileExists(systemPropertiesFile)) ! myPropertiesInputFile = systemPropertiesFile; ! else ! myPropertiesInputFile = ""; } *************** *** 70,76 **** buf << myStateDir << md5 << ".st" << state; ! myStateFile = buf.str(); ! ! return myStateFile; } --- 78,82 ---- buf << myStateDir << md5 << ".st" << state; ! return buf.str(); } *************** *** 78,81 **** bool SettingsUNIX::fileExists(const string& filename) { ! return (access(filename.c_str(), F_OK|W_OK) == 0); } --- 84,87 ---- bool SettingsUNIX::fileExists(const string& filename) { ! return (access(filename.c_str(), F_OK) == 0); } |