Fix a confusing case: if eg. both "My Docs\StepMania\Save\Preferences.ini"

and "Program Files\StepMania\Save\Preferences.ini" exist, we'll read and
write the PF one consistently.  However, if the PF one is read-only, we'll read
the one in PF and write the one in Docs, which is useless and confusing.  Only
write to files if we'll read them, too.
This commit is contained in:
Glenn Maynard
2006-08-31 19:28:12 +00:00
parent 62201740fa
commit 073bfeade6
+9
View File
@@ -806,10 +806,19 @@ RageFileBasic *RageFileManager::OpenForWriting( const RString &sPath, int mode,
stable_sort( Values.begin(), Values.end(), SortBySecond );
/* Only write files if they'll be read. If a file exists in any driver, don't
* create or write files in any driver mounted after it, because when we later
* try to read it, we'll get that file and not the one we wrote. */
int iMaximumDriver = apDriverList.size();
if( Values.size() > 0 && Values[0].second == 0 )
iMaximumDriver = Values[0].first;
iError = 0;
for( unsigned i = 0; i < Values.size(); ++i )
{
const int iDriver = Values[i].first;
if( iDriver > iMaximumDriver )
continue;
LoadedDriver &ld = *apDriverList[iDriver];
const RString sDriverPath = ld.GetPath( sPath );
ASSERT( !sDriverPath.empty() );