From e9ae2c08036b4f8ac10109b18b6ecb60ab84c4c1 Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Wed, 10 Dec 2003 09:44:16 +0000 Subject: [PATCH] continue phasing out BASE_PATH and SLASH --- stepmania/src/BGAnimation.cpp | 11 ++++------- stepmania/src/BGAnimationLayer.cpp | 4 ++-- stepmania/src/BeginnerHelper.cpp | 2 +- stepmania/src/GameState.cpp | 2 +- stepmania/src/NoteSkinManager.cpp | 4 ++-- stepmania/src/RageFile.cpp | 7 +++---- stepmania/src/RageFileDriver.cpp | 4 ++-- stepmania/src/RageSoundManager.cpp | 4 ++-- stepmania/src/SongCacheIndex.cpp | 4 ++-- stepmania/src/SongManager.cpp | 20 ++++++++++---------- stepmania/src/StepMania.cpp | 2 +- stepmania/src/ThemeManager.cpp | 16 ++++++++-------- stepmania/src/Transition.cpp | 4 ++-- 13 files changed, 40 insertions(+), 44 deletions(-) diff --git a/stepmania/src/BGAnimation.cpp b/stepmania/src/BGAnimation.cpp index 95108a4e29..5f1e817e0a 100644 --- a/stepmania/src/BGAnimation.cpp +++ b/stepmania/src/BGAnimation.cpp @@ -57,8 +57,8 @@ void AddLayersFromAniDir( CString sAniDir, vector &layersAddT if( sAniDir.empty() ) return; - if( sAniDir.Right(1) != SLASH ) - sAniDir += SLASH; + if( sAniDir.Right(1) != "/" ) + sAniDir += "/"; RAGE_ASSERT_M( IsADirectory(sAniDir), sAniDir + " isn't a directory" ); @@ -79,9 +79,6 @@ void AddLayersFromAniDir( CString sAniDir, vector &layersAddT if( ini.GetValue(sLayer, "Import", sImportDir) ) { // import a whole BGAnimation -#ifdef _XBOX - sImportDir.Replace( "/", SLASH ); -#endif sImportDir = sAniDir + sImportDir; CollapsePath( sImportDir ); AddLayersFromAniDir( sImportDir, layersAddTo, Generic ); @@ -104,8 +101,8 @@ void BGAnimation::LoadFromAniDir( CString sAniDir ) if( sAniDir.empty() ) return; - if( sAniDir.Right(1) != SLASH ) - sAniDir += SLASH; + if( sAniDir.Right(1) != "/" ) + sAniDir += "/"; RAGE_ASSERT_M( IsADirectory(sAniDir), sAniDir + " isn't a directory" ); diff --git a/stepmania/src/BGAnimationLayer.cpp b/stepmania/src/BGAnimationLayer.cpp index 91763b3d6c..604bf5328b 100644 --- a/stepmania/src/BGAnimationLayer.cpp +++ b/stepmania/src/BGAnimationLayer.cpp @@ -434,8 +434,8 @@ void BGAnimationLayer::LoadFromAniLayerFile( CString sPath ) void BGAnimationLayer::LoadFromIni( CString sAniDir, CString sLayer ) { Init(); - if( sAniDir.Right(1) != SLASH ) - sAniDir += SLASH; + if( sAniDir.Right(1) != "/" ) + sAniDir += "/"; ASSERT( IsADirectory(sAniDir) ); diff --git a/stepmania/src/BeginnerHelper.cpp b/stepmania/src/BeginnerHelper.cpp index eca846feb6..62056e5d8e 100644 --- a/stepmania/src/BeginnerHelper.cpp +++ b/stepmania/src/BeginnerHelper.cpp @@ -57,7 +57,7 @@ static const char *anims[NUM_ANIMATIONS] = static CString GetAnimPath( Animation a ) { - return ssprintf("Characters%s%s", SLASH, anims[a]); + return CString("Characters/") + anims[a]; } diff --git a/stepmania/src/GameState.cpp b/stepmania/src/GameState.cpp index 430a5bdde7..66511c6601 100644 --- a/stepmania/src/GameState.cpp +++ b/stepmania/src/GameState.cpp @@ -303,7 +303,7 @@ void GameState::ReloadCharacters() } if( !FoundDefault ) - RageException::Throw( "'Characters" SLASH "default' is missing." ); + RageException::Throw( "'Characters/default' is missing." ); // If FoundDefault, then we're not empty. -Chris // if( m_pCharacters.empty() ) diff --git a/stepmania/src/NoteSkinManager.cpp b/stepmania/src/NoteSkinManager.cpp index 4a103e01e8..c02a57f09c 100644 --- a/stepmania/src/NoteSkinManager.cpp +++ b/stepmania/src/NoteSkinManager.cpp @@ -48,7 +48,7 @@ void NoteSkinManager::RefreshNoteSkinData( Game game ) GameDef* pGameDef = GAMEMAN->GetGameDefForGame( game ); - CString sBaseSkinFolder = NOTESKINS_DIR + pGameDef->m_szName + SLASH; + CString sBaseSkinFolder = NOTESKINS_DIR + pGameDef->m_szName + "/"; CStringArray asNoteSkinNames; GetDirListing( sBaseSkinFolder + "*", asNoteSkinNames, true ); @@ -156,7 +156,7 @@ CString NoteSkinManager::GetNoteSkinDir( CString sSkinName ) { CString sGame = GAMESTATE->GetCurrentGameDef()->m_szName; - return NOTESKINS_DIR + sGame + SLASH + sSkinName + SLASH; + return NOTESKINS_DIR + sGame + "/" + sSkinName + "/"; } CString NoteSkinManager::GetMetric( CString sNoteSkinName, CString sButtonName, CString sValue ) diff --git a/stepmania/src/RageFile.cpp b/stepmania/src/RageFile.cpp index 1567c807c7..cf9c2c677a 100644 --- a/stepmania/src/RageFile.cpp +++ b/stepmania/src/RageFile.cpp @@ -26,15 +26,14 @@ void FixSlashesInPlace( CString &sPath ) CString FixSlashes( CString sPath ) { - sPath.Replace( "/", SLASH ); - sPath.Replace( "\\", SLASH ); + FixSlashesInPlace( sPath ); return sPath; } void CollapsePath( CString &sPath ) { CStringArray as; - split( sPath, SLASH, as ); + split( sPath, "/", as ); for( unsigned i=0; i parts; - split( path, SLASH, parts, true ); + split( path, "/", parts, true ); CString PartialPath; @@ -76,7 +76,7 @@ int RageFileDriver::GetPathValue( const CString &path ) { PartialPath += parts[i]; if( i+1 < parts.size() ) - PartialPath += SLASH; + PartialPath += "/"; const RageFileManager::FileType Type = GetFileType( PartialPath ); switch( Type ) diff --git a/stepmania/src/RageSoundManager.cpp b/stepmania/src/RageSoundManager.cpp index 2004529e11..7262b5172c 100644 --- a/stepmania/src/RageSoundManager.cpp +++ b/stepmania/src/RageSoundManager.cpp @@ -215,8 +215,8 @@ void RageSoundManager::PlayOnceFromDir( CString sDir ) return; // make sure there's a slash at the end of this path - if( sDir.Right(1) != SLASH ) - sDir += SLASH; + if( sDir.Right(1) != "/" ) + sDir += "/"; CStringArray arraySoundFiles; GetDirListing( sDir + "*.mp3", arraySoundFiles ); diff --git a/stepmania/src/SongCacheIndex.cpp b/stepmania/src/SongCacheIndex.cpp index a0e0b55b86..e834349f1d 100644 --- a/stepmania/src/SongCacheIndex.cpp +++ b/stepmania/src/SongCacheIndex.cpp @@ -53,8 +53,8 @@ void SongCacheIndex::ReadCacheIndex() LOG->Trace( "Cache format is out of date. Deleting all cache files." ); EmptyDir( CACHE_DIR ); - EmptyDir( CACHE_DIR "Banners" SLASH ); - EmptyDir( CACHE_DIR "Songs" SLASH ); + EmptyDir( CACHE_DIR "Banners/" ); + EmptyDir( CACHE_DIR "Songs/" ); CacheIndex.Reset(); } diff --git a/stepmania/src/SongManager.cpp b/stepmania/src/SongManager.cpp index 9b536a34da..a5e5e91cd8 100644 --- a/stepmania/src/SongManager.cpp +++ b/stepmania/src/SongManager.cpp @@ -146,7 +146,7 @@ void SongManager::AddGroup( CString sDir, CString sGroupDirName ) CString sBannerPath; if( !arrayGroupBanners.empty() ) - sBannerPath = sDir+sGroupDirName+SLASH+arrayGroupBanners[0] ; + sBannerPath = sDir+sGroupDirName+"/"+arrayGroupBanners[0] ; else { // Look for a group banner in the parent folder @@ -167,8 +167,8 @@ void SongManager::AddGroup( CString sDir, CString sGroupDirName ) void SongManager::LoadStepManiaSongDir( CString sDir, LoadingWindow *ld ) { /* Make sure sDir has a trailing slash. */ - TrimRight( sDir, "/\\" ); - sDir += SLASH; + if( sDir.Right(1) != "/" ) + sDir += "/"; // Find all group directories in "Songs" folder CStringArray arrayGroupDirs; @@ -186,7 +186,7 @@ void SongManager::LoadStepManiaSongDir( CString sDir, LoadingWindow *ld ) // Find all Song folders in this group directory CStringArray arraySongDirs; - GetDirListing( sDir+sGroupDirName + SLASH "*", arraySongDirs, true, true ); + GetDirListing( sDir+sGroupDirName + "/*", arraySongDirs, true, true ); SortCStringArray( arraySongDirs ); unsigned j; @@ -235,12 +235,12 @@ void SongManager::LoadGroupSymLinks(CString sDir, CString sGroupFolder) { // Find all symlink files in this folder CStringArray arraySymLinks; - GetDirListing( sDir+sGroupFolder+SLASH+"*.include", arraySymLinks, false ); + GetDirListing( sDir+sGroupFolder+"/*.include", arraySymLinks, false ); SortCStringArray( arraySymLinks ); for( unsigned s=0; s< arraySymLinks.size(); s++ ) // for each symlink in this dir, add it in as a song. { MsdFile msdF; - msdF.ReadFile( sDir+sGroupFolder+SLASH+arraySymLinks[s].c_str() ); + msdF.ReadFile( sDir+sGroupFolder+"/"+arraySymLinks[s].c_str() ); CString sSymDestination = msdF.GetParam(0,1); // Should only be 1 vale¶m...period. Song* pNewSong = new Song; @@ -511,7 +511,7 @@ void SongManager::InitCoursesFromDisk( LoadingWindow *ld ) // Find all CRS files in this group directory CStringArray arrayCoursePaths; - GetDirListing( COURSES_DIR + sGroupDirName + SLASH + "*.crs", arrayCoursePaths, false, true ); + GetDirListing( COURSES_DIR + sGroupDirName + "/*.crs", arrayCoursePaths, false, true ); SortCStringArray( arrayCoursePaths ); for( unsigned j=0; j &AddTo, bool bIncludeAutoge bool SongManager::GetExtraStageInfoFromCourse( bool bExtra2, CString sPreferredGroup, Song*& pSongOut, Steps*& pNotesOut, PlayerOptions& po_out, SongOptions& so_out ) { - const CString sCourseSuffix = sPreferredGroup + SLASH + (bExtra2 ? "extra2" : "extra1") + ".crs"; + const CString sCourseSuffix = sPreferredGroup + "/" + (bExtra2 ? "extra2" : "extra1") + ".crs"; CString sCoursePath = SONGS_DIR + sCourseSuffix; /* Couldn't find course in DWI path or alternative song folders */ @@ -750,8 +750,8 @@ Song* SongManager::GetRandomSong() Song* SongManager::GetSongFromDir( CString sDir ) { - if( sDir.Right(1) != SLASH ) - sDir += SLASH; + if( sDir.Right(1) != "/" ) + sDir += "/"; for( unsigned int i=0; iGetSongDir()) == 0 ) diff --git a/stepmania/src/StepMania.cpp b/stepmania/src/StepMania.cpp index a8faa478cb..89cde04cf4 100644 --- a/stepmania/src/StepMania.cpp +++ b/stepmania/src/StepMania.cpp @@ -1108,7 +1108,7 @@ bool HandleGlobalInputs( DeviceInput DeviceI, InputEventType type, GameInput Gam /* XXX slow? */ for( int i=0; i<10000; i++ ) { - sPath = ssprintf("Screenshots" SLASH "screen%04d.bmp",i); + sPath = ssprintf("Screenshots/screen%04d.bmp",i); if( !DoesFileExist(sPath) ) break; } diff --git a/stepmania/src/ThemeManager.cpp b/stepmania/src/ThemeManager.cpp index 5068f0cdac..7198eea915 100644 --- a/stepmania/src/ThemeManager.cpp +++ b/stepmania/src/ThemeManager.cpp @@ -33,7 +33,7 @@ ThemeManager* THEME = NULL; // global object accessable from anywhere in the pro const CString BASE_THEME_NAME = "default"; const CString FALLBACK_THEME_NAME = "fallback"; -const CString LANGUAGES_SUBDIR = "Languages" SLASH; +const CString LANGUAGES_SUBDIR = "Languages/"; const CString BASE_LANGUAGE = "english"; const CString THEMES_DIR = "Themes/"; const CString METRICS_FILE = "metrics.ini"; @@ -174,7 +174,7 @@ void ThemeManager::SwitchThemeAndLanguage( CString sThemeName, CString sLanguage CString ThemeManager::GetThemeDirFromName( const CString &sThemeName ) { - return THEMES_DIR + sThemeName + SLASH; + return THEMES_DIR + sThemeName + "/"; } CString ThemeManager::GetPathTo( CString sThemeName, ElementCategory category, CString sFileName ) @@ -193,17 +193,17 @@ try_element_again: if( bLookingForSpecificFile ) { - GetDirListing( sThemeDir + sCategory+SLASH+sFileName, asElementPaths, bDirsOnly, true ); + GetDirListing( sThemeDir + sCategory+"/"+sFileName, asElementPaths, bDirsOnly, true ); } else // look for all files starting with sFileName that have types we can use { /* First, look for redirs. */ - GetDirListing( sThemeDir + sCategory + SLASH + sFileName + ".redir", + GetDirListing( sThemeDir + sCategory + "/" + sFileName + ".redir", asElementPaths, false, true ); const CString wildcard = (category == BGAnimations? "":"*"); CStringArray asPaths; - GetDirListing( sThemeDir + sCategory + SLASH + sFileName + wildcard, + GetDirListing( sThemeDir + sCategory + "/" + sFileName + wildcard, asPaths, bDirsOnly, true ); for( unsigned p = 0; p < asPaths.size(); ++p ) @@ -347,7 +347,7 @@ try_element_again: CString sCategory = ELEMENT_CATEGORY_STRING[category]; - CString sMessage = "The theme element '" + sCategory + SLASH + sFileName +"' is missing."; + CString sMessage = "The theme element '" + sCategory + "/" + sFileName +"' is missing."; switch( HOOKS->MessageBoxAbortRetryIgnore(sMessage, "MissingThemeElement") ) { case ArchHooks::retry: @@ -356,7 +356,7 @@ try_element_again: goto try_element_again; case ArchHooks::ignore: LOG->Warn( - "Theme element '%s" SLASH "%s' could not be found in '%s' or '%s'.", + "Theme element '%s/%s' could not be found in '%s' or '%s'.", sCategory.c_str(), sFileName.c_str(), GetThemeDirFromName(m_sCurThemeName).c_str(), @@ -369,7 +369,7 @@ try_element_again: Cache[sFileName] = GetPathTo( category, "_missing" ); return Cache[sFileName]; case ArchHooks::abort: - RageException::Throw( "Theme element '%s" SLASH "%s' could not be found in '%s' or '%s'.", + RageException::Throw( "Theme element '%s/%s' could not be found in '%s' or '%s'.", sCategory.c_str(), sFileName.c_str(), GetThemeDirFromName(m_sCurThemeName).c_str(), diff --git a/stepmania/src/Transition.cpp b/stepmania/src/Transition.cpp index 699131fa3e..aa3f62da22 100644 --- a/stepmania/src/Transition.cpp +++ b/stepmania/src/Transition.cpp @@ -25,8 +25,8 @@ Transition::Transition() void Transition::Load( CString sBGAniDir ) { - if( !sBGAniDir.empty() && sBGAniDir.Right(1) != SLASH ) - sBGAniDir += SLASH; + if( !sBGAniDir.empty() && sBGAniDir.Right(1) != "/" ) + sBGAniDir += "/"; m_BGAnimation.LoadFromAniDir( sBGAniDir );