From 57c526230b08fd7a4bbab2727f75d05eaeb21344 Mon Sep 17 00:00:00 2001 From: Thad Ward Date: Thu, 19 Feb 2004 08:45:17 +0000 Subject: [PATCH] Create PREFSMAN and mount any additional paths it mentions earlier. Remove DWIPath from prefs. Add AdditionalFolders to prefs (replaces DWIPath, essentially). Store CStrings instead of CStringArrays in prefsman, and split them on use. --- stepmania/src/PrefsManager.cpp | 16 ++++++---------- stepmania/src/PrefsManager.h | 4 ++-- stepmania/src/StepMania.cpp | 27 ++++++++++++++++++++------- 3 files changed, 28 insertions(+), 19 deletions(-) diff --git a/stepmania/src/PrefsManager.cpp b/stepmania/src/PrefsManager.cpp index 098acba135..66bc24cca7 100644 --- a/stepmania/src/PrefsManager.cpp +++ b/stepmania/src/PrefsManager.cpp @@ -405,7 +405,6 @@ void PrefsManager::ReadGlobalPrefsFromDisk() ini.GetValue( "Options", "ShowSelectGroup", m_bShowSelectGroup ); ini.GetValue( "Options", "ShowNative", m_bShowNative ); ini.GetValue( "Options", "ArcadeOptionsNavigation", m_bArcadeOptionsNavigation ); - ini.GetValue( "Options", "DWIPath", m_DWIPath ); ini.GetValue( "Options", "DelayedTextureDelete", m_bDelayedTextureDelete ); ini.GetValue( "Options", "TexturePreload", m_bTexturePreload ); ini.GetValue( "Options", "DelayedScreenLoad", m_bDelayedScreenLoad ); @@ -498,13 +497,10 @@ void PrefsManager::ReadGlobalPrefsFromDisk() ini.GetValue( "Editor", "ShowBGChangesPlay", m_bEditorShowBGChangesPlay ); - CString sAdditionalSongFolders; - if( ini.GetValue( "Options", "AdditionalSongFolders", sAdditionalSongFolders ) ) - { - FixSlashesInPlace( sAdditionalSongFolders ); - m_asAdditionalSongFolders.clear(); - split( sAdditionalSongFolders, ",", m_asAdditionalSongFolders, true ); - } + ini.GetValue( "Options", "AdditionalSongFolders", m_sAdditionalSongFolders ); + ini.GetValue( "Options", "AdditionalFolders", m_sAdditionalFolders ); + FixSlashesInPlace(m_sAdditionalSongFolders); + FixSlashesInPlace(m_sAdditionalFolders); ini.GetValue( "Debug", "Logging", m_bLogging ); ini.GetValue( "Debug", "ForceLogFlush", m_bForceLogFlush ); @@ -629,7 +625,6 @@ void PrefsManager::SaveGlobalPrefsToDisk() const ini.SetValue( "Options", "ShowSelectGroup", m_bShowSelectGroup ); ini.SetValue( "Options", "ShowNative", m_bShowNative ); ini.SetValue( "Options", "ArcadeOptionsNavigation", m_bArcadeOptionsNavigation ); - ini.SetValue( "Options", "DWIPath", m_DWIPath ); ini.SetValue( "Options", "DelayedTextureDelete", m_bDelayedTextureDelete ); ini.SetValue( "Options", "TexturePreload", m_bTexturePreload ); ini.SetValue( "Options", "DelayedScreenLoad", m_bDelayedScreenLoad ); @@ -728,7 +723,8 @@ void PrefsManager::SaveGlobalPrefsToDisk() const if(m_sMovieDrivers != DEFAULT_MOVIE_DRIVER_LIST) ini.SetValue ( "Options", "MovieDrivers", m_sMovieDrivers ); - ini.SetValue( "Options", "AdditionalSongFolders", join(",", m_asAdditionalSongFolders) ); + ini.SetValue( "Options", "AdditionalSongFolders", m_sAdditionalSongFolders); + ini.SetValue( "Options", "AdditionalFolders", m_sAdditionalFolders); ini.SetValue( "Debug", "Logging", m_bLogging ); ini.SetValue( "Debug", "ForceLogFlush", m_bForceLogFlush ); diff --git a/stepmania/src/PrefsManager.h b/stepmania/src/PrefsManager.h index 787a48ca03..785f74bf22 100644 --- a/stepmania/src/PrefsManager.h +++ b/stepmania/src/PrefsManager.h @@ -209,8 +209,8 @@ public: /* 0 = no; 1 = yes; -1 = auto (do whatever is appropriate for the arch). */ int m_iBoostAppPriority; - CStringArray m_asAdditionalSongFolders; - CString m_DWIPath; + CString m_sAdditionalSongFolders; + CString m_sAdditionalFolders; CString m_sLastSeenVideoDriver; CString m_sLastSeenInputDevices; diff --git a/stepmania/src/StepMania.cpp b/stepmania/src/StepMania.cpp index 797a4f569e..1e286e7041 100644 --- a/stepmania/src/StepMania.cpp +++ b/stepmania/src/StepMania.cpp @@ -890,6 +890,26 @@ int main(int argc, char* argv[]) /* Whew--we should be able to crash safely now! */ + // + // load preferences and mount any alternative trees. + // + PREFSMAN = new PrefsManager; + + /* Set up alternative filesystem trees. */ + if( PREFSMAN->m_sAdditionalFolders != "" ) + { + CStringArray dirs; + split( PREFSMAN->m_sAdditionalFolders, ",", dirs, true ); + for( unsigned i=0; i < dirs.size(); i++) + FILEMAN->Mount( "dir", dirs[i], "" ); + } + if( PREFSMAN->m_sAdditionalSongFolders != "" ) + { + CStringArray dirs; + split( PREFSMAN->m_sAdditionalSongFolders, ",", dirs, true ); + for( unsigned i=0; i < dirs.size(); i++) + FILEMAN->Mount( "dir", dirs[i], "Songs" ); + } MountTreeOfZips( ZIPS_DIR ); atexit(SDL_Quit); /* Clean up on exit */ @@ -902,7 +922,6 @@ int main(int argc, char* argv[]) // Create game objects // GAMESTATE = new GameState; - PREFSMAN = new PrefsManager; LOG->ShowLogOutput( PREFSMAN->m_bShowLogOutput ); LOG->SetLogging( PREFSMAN->m_bLogging ); @@ -934,12 +953,6 @@ int main(int argc, char* argv[]) CheckSettings(); - /* Set up alternative filesystem trees. */ - for( unsigned i=0; im_asAdditionalSongFolders.size(); i++ ) - FILEMAN->Mount( "dir", PREFSMAN->m_asAdditionalSongFolders[i], "Songs" ); - if( PREFSMAN->m_DWIPath != "" ) - FILEMAN->Mount( "dir", PREFSMAN->m_DWIPath, "" ); - GAMEMAN = new GameManager; THEME = new ThemeManager; ANNOUNCER = new AnnouncerManager;