continue phasing out BASE_PATH and SLASH

This commit is contained in:
Glenn Maynard
2003-12-10 09:44:16 +00:00
parent cd7ab704cb
commit e9ae2c0803
13 changed files with 40 additions and 44 deletions
+4 -7
View File
@@ -57,8 +57,8 @@ void AddLayersFromAniDir( CString sAniDir, vector<BGAnimationLayer*> &layersAddT
if( sAniDir.empty() ) if( sAniDir.empty() )
return; return;
if( sAniDir.Right(1) != SLASH ) if( sAniDir.Right(1) != "/" )
sAniDir += SLASH; sAniDir += "/";
RAGE_ASSERT_M( IsADirectory(sAniDir), sAniDir + " isn't a directory" ); RAGE_ASSERT_M( IsADirectory(sAniDir), sAniDir + " isn't a directory" );
@@ -79,9 +79,6 @@ void AddLayersFromAniDir( CString sAniDir, vector<BGAnimationLayer*> &layersAddT
if( ini.GetValue(sLayer, "Import", sImportDir) ) if( ini.GetValue(sLayer, "Import", sImportDir) )
{ {
// import a whole BGAnimation // import a whole BGAnimation
#ifdef _XBOX
sImportDir.Replace( "/", SLASH );
#endif
sImportDir = sAniDir + sImportDir; sImportDir = sAniDir + sImportDir;
CollapsePath( sImportDir ); CollapsePath( sImportDir );
AddLayersFromAniDir( sImportDir, layersAddTo, Generic ); AddLayersFromAniDir( sImportDir, layersAddTo, Generic );
@@ -104,8 +101,8 @@ void BGAnimation::LoadFromAniDir( CString sAniDir )
if( sAniDir.empty() ) if( sAniDir.empty() )
return; return;
if( sAniDir.Right(1) != SLASH ) if( sAniDir.Right(1) != "/" )
sAniDir += SLASH; sAniDir += "/";
RAGE_ASSERT_M( IsADirectory(sAniDir), sAniDir + " isn't a directory" ); RAGE_ASSERT_M( IsADirectory(sAniDir), sAniDir + " isn't a directory" );
+2 -2
View File
@@ -434,8 +434,8 @@ void BGAnimationLayer::LoadFromAniLayerFile( CString sPath )
void BGAnimationLayer::LoadFromIni( CString sAniDir, CString sLayer ) void BGAnimationLayer::LoadFromIni( CString sAniDir, CString sLayer )
{ {
Init(); Init();
if( sAniDir.Right(1) != SLASH ) if( sAniDir.Right(1) != "/" )
sAniDir += SLASH; sAniDir += "/";
ASSERT( IsADirectory(sAniDir) ); ASSERT( IsADirectory(sAniDir) );
+1 -1
View File
@@ -57,7 +57,7 @@ static const char *anims[NUM_ANIMATIONS] =
static CString GetAnimPath( Animation a ) static CString GetAnimPath( Animation a )
{ {
return ssprintf("Characters%s%s", SLASH, anims[a]); return CString("Characters/") + anims[a];
} }
+1 -1
View File
@@ -303,7 +303,7 @@ void GameState::ReloadCharacters()
} }
if( !FoundDefault ) if( !FoundDefault )
RageException::Throw( "'Characters" SLASH "default' is missing." ); RageException::Throw( "'Characters/default' is missing." );
// If FoundDefault, then we're not empty. -Chris // If FoundDefault, then we're not empty. -Chris
// if( m_pCharacters.empty() ) // if( m_pCharacters.empty() )
+2 -2
View File
@@ -48,7 +48,7 @@ void NoteSkinManager::RefreshNoteSkinData( Game game )
GameDef* pGameDef = GAMEMAN->GetGameDefForGame( game ); GameDef* pGameDef = GAMEMAN->GetGameDefForGame( game );
CString sBaseSkinFolder = NOTESKINS_DIR + pGameDef->m_szName + SLASH; CString sBaseSkinFolder = NOTESKINS_DIR + pGameDef->m_szName + "/";
CStringArray asNoteSkinNames; CStringArray asNoteSkinNames;
GetDirListing( sBaseSkinFolder + "*", asNoteSkinNames, true ); GetDirListing( sBaseSkinFolder + "*", asNoteSkinNames, true );
@@ -156,7 +156,7 @@ CString NoteSkinManager::GetNoteSkinDir( CString sSkinName )
{ {
CString sGame = GAMESTATE->GetCurrentGameDef()->m_szName; 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 ) CString NoteSkinManager::GetMetric( CString sNoteSkinName, CString sButtonName, CString sValue )
+3 -4
View File
@@ -26,15 +26,14 @@ void FixSlashesInPlace( CString &sPath )
CString FixSlashes( CString sPath ) CString FixSlashes( CString sPath )
{ {
sPath.Replace( "/", SLASH ); FixSlashesInPlace( sPath );
sPath.Replace( "\\", SLASH );
return sPath; return sPath;
} }
void CollapsePath( CString &sPath ) void CollapsePath( CString &sPath )
{ {
CStringArray as; CStringArray as;
split( sPath, SLASH, as ); split( sPath, "/", as );
for( unsigned i=0; i<as.size(); i++ ) for( unsigned i=0; i<as.size(); i++ )
{ {
@@ -45,7 +44,7 @@ void CollapsePath( CString &sPath )
i -= 2; i -= 2;
} }
} }
sPath = join( SLASH, as ); sPath = join( "/", as );
} }
RageFile::RageFile() RageFile::RageFile()
+2 -2
View File
@@ -68,7 +68,7 @@ int RageFileObj::GetFileSize()
int RageFileDriver::GetPathValue( const CString &path ) int RageFileDriver::GetPathValue( const CString &path )
{ {
vector<CString> parts; vector<CString> parts;
split( path, SLASH, parts, true ); split( path, "/", parts, true );
CString PartialPath; CString PartialPath;
@@ -76,7 +76,7 @@ int RageFileDriver::GetPathValue( const CString &path )
{ {
PartialPath += parts[i]; PartialPath += parts[i];
if( i+1 < parts.size() ) if( i+1 < parts.size() )
PartialPath += SLASH; PartialPath += "/";
const RageFileManager::FileType Type = GetFileType( PartialPath ); const RageFileManager::FileType Type = GetFileType( PartialPath );
switch( Type ) switch( Type )
+2 -2
View File
@@ -215,8 +215,8 @@ void RageSoundManager::PlayOnceFromDir( CString sDir )
return; return;
// make sure there's a slash at the end of this path // make sure there's a slash at the end of this path
if( sDir.Right(1) != SLASH ) if( sDir.Right(1) != "/" )
sDir += SLASH; sDir += "/";
CStringArray arraySoundFiles; CStringArray arraySoundFiles;
GetDirListing( sDir + "*.mp3", arraySoundFiles ); GetDirListing( sDir + "*.mp3", arraySoundFiles );
+2 -2
View File
@@ -53,8 +53,8 @@ void SongCacheIndex::ReadCacheIndex()
LOG->Trace( "Cache format is out of date. Deleting all cache files." ); LOG->Trace( "Cache format is out of date. Deleting all cache files." );
EmptyDir( CACHE_DIR ); EmptyDir( CACHE_DIR );
EmptyDir( CACHE_DIR "Banners" SLASH ); EmptyDir( CACHE_DIR "Banners/" );
EmptyDir( CACHE_DIR "Songs" SLASH ); EmptyDir( CACHE_DIR "Songs/" );
CacheIndex.Reset(); CacheIndex.Reset();
} }
+10 -10
View File
@@ -146,7 +146,7 @@ void SongManager::AddGroup( CString sDir, CString sGroupDirName )
CString sBannerPath; CString sBannerPath;
if( !arrayGroupBanners.empty() ) if( !arrayGroupBanners.empty() )
sBannerPath = sDir+sGroupDirName+SLASH+arrayGroupBanners[0] ; sBannerPath = sDir+sGroupDirName+"/"+arrayGroupBanners[0] ;
else else
{ {
// Look for a group banner in the parent folder // 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 ) void SongManager::LoadStepManiaSongDir( CString sDir, LoadingWindow *ld )
{ {
/* Make sure sDir has a trailing slash. */ /* Make sure sDir has a trailing slash. */
TrimRight( sDir, "/\\" ); if( sDir.Right(1) != "/" )
sDir += SLASH; sDir += "/";
// Find all group directories in "Songs" folder // Find all group directories in "Songs" folder
CStringArray arrayGroupDirs; CStringArray arrayGroupDirs;
@@ -186,7 +186,7 @@ void SongManager::LoadStepManiaSongDir( CString sDir, LoadingWindow *ld )
// Find all Song folders in this group directory // Find all Song folders in this group directory
CStringArray arraySongDirs; CStringArray arraySongDirs;
GetDirListing( sDir+sGroupDirName + SLASH "*", arraySongDirs, true, true ); GetDirListing( sDir+sGroupDirName + "/*", arraySongDirs, true, true );
SortCStringArray( arraySongDirs ); SortCStringArray( arraySongDirs );
unsigned j; unsigned j;
@@ -235,12 +235,12 @@ void SongManager::LoadGroupSymLinks(CString sDir, CString sGroupFolder)
{ {
// Find all symlink files in this folder // Find all symlink files in this folder
CStringArray arraySymLinks; CStringArray arraySymLinks;
GetDirListing( sDir+sGroupFolder+SLASH+"*.include", arraySymLinks, false ); GetDirListing( sDir+sGroupFolder+"/*.include", arraySymLinks, false );
SortCStringArray( arraySymLinks ); SortCStringArray( arraySymLinks );
for( unsigned s=0; s< arraySymLinks.size(); s++ ) // for each symlink in this dir, add it in as a song. for( unsigned s=0; s< arraySymLinks.size(); s++ ) // for each symlink in this dir, add it in as a song.
{ {
MsdFile msdF; 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&param...period. CString sSymDestination = msdF.GetParam(0,1); // Should only be 1 vale&param...period.
Song* pNewSong = new Song; Song* pNewSong = new Song;
@@ -511,7 +511,7 @@ void SongManager::InitCoursesFromDisk( LoadingWindow *ld )
// Find all CRS files in this group directory // Find all CRS files in this group directory
CStringArray arrayCoursePaths; CStringArray arrayCoursePaths;
GetDirListing( COURSES_DIR + sGroupDirName + SLASH + "*.crs", arrayCoursePaths, false, true ); GetDirListing( COURSES_DIR + sGroupDirName + "/*.crs", arrayCoursePaths, false, true );
SortCStringArray( arrayCoursePaths ); SortCStringArray( arrayCoursePaths );
for( unsigned j=0; j<arrayCoursePaths.size(); j++ ) for( unsigned j=0; j<arrayCoursePaths.size(); j++ )
@@ -615,7 +615,7 @@ void SongManager::GetEndlessCourses( vector<Course*> &AddTo, bool bIncludeAutoge
bool SongManager::GetExtraStageInfoFromCourse( bool bExtra2, CString sPreferredGroup, bool SongManager::GetExtraStageInfoFromCourse( bool bExtra2, CString sPreferredGroup,
Song*& pSongOut, Steps*& pNotesOut, PlayerOptions& po_out, SongOptions& so_out ) 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; CString sCoursePath = SONGS_DIR + sCourseSuffix;
/* Couldn't find course in DWI path or alternative song folders */ /* Couldn't find course in DWI path or alternative song folders */
@@ -750,8 +750,8 @@ Song* SongManager::GetRandomSong()
Song* SongManager::GetSongFromDir( CString sDir ) Song* SongManager::GetSongFromDir( CString sDir )
{ {
if( sDir.Right(1) != SLASH ) if( sDir.Right(1) != "/" )
sDir += SLASH; sDir += "/";
for( unsigned int i=0; i<m_pSongs.size(); i++ ) for( unsigned int i=0; i<m_pSongs.size(); i++ )
if( sDir.CompareNoCase(m_pSongs[i]->GetSongDir()) == 0 ) if( sDir.CompareNoCase(m_pSongs[i]->GetSongDir()) == 0 )
+1 -1
View File
@@ -1108,7 +1108,7 @@ bool HandleGlobalInputs( DeviceInput DeviceI, InputEventType type, GameInput Gam
/* XXX slow? */ /* XXX slow? */
for( int i=0; i<10000; i++ ) 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) ) if( !DoesFileExist(sPath) )
break; break;
} }
+8 -8
View File
@@ -33,7 +33,7 @@ ThemeManager* THEME = NULL; // global object accessable from anywhere in the pro
const CString BASE_THEME_NAME = "default"; const CString BASE_THEME_NAME = "default";
const CString FALLBACK_THEME_NAME = "fallback"; const CString FALLBACK_THEME_NAME = "fallback";
const CString LANGUAGES_SUBDIR = "Languages" SLASH; const CString LANGUAGES_SUBDIR = "Languages/";
const CString BASE_LANGUAGE = "english"; const CString BASE_LANGUAGE = "english";
const CString THEMES_DIR = "Themes/"; const CString THEMES_DIR = "Themes/";
const CString METRICS_FILE = "metrics.ini"; const CString METRICS_FILE = "metrics.ini";
@@ -174,7 +174,7 @@ void ThemeManager::SwitchThemeAndLanguage( CString sThemeName, CString sLanguage
CString ThemeManager::GetThemeDirFromName( const CString &sThemeName ) CString ThemeManager::GetThemeDirFromName( const CString &sThemeName )
{ {
return THEMES_DIR + sThemeName + SLASH; return THEMES_DIR + sThemeName + "/";
} }
CString ThemeManager::GetPathTo( CString sThemeName, ElementCategory category, CString sFileName ) CString ThemeManager::GetPathTo( CString sThemeName, ElementCategory category, CString sFileName )
@@ -193,17 +193,17 @@ try_element_again:
if( bLookingForSpecificFile ) 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 else // look for all files starting with sFileName that have types we can use
{ {
/* First, look for redirs. */ /* First, look for redirs. */
GetDirListing( sThemeDir + sCategory + SLASH + sFileName + ".redir", GetDirListing( sThemeDir + sCategory + "/" + sFileName + ".redir",
asElementPaths, false, true ); asElementPaths, false, true );
const CString wildcard = (category == BGAnimations? "":"*"); const CString wildcard = (category == BGAnimations? "":"*");
CStringArray asPaths; CStringArray asPaths;
GetDirListing( sThemeDir + sCategory + SLASH + sFileName + wildcard, GetDirListing( sThemeDir + sCategory + "/" + sFileName + wildcard,
asPaths, bDirsOnly, true ); asPaths, bDirsOnly, true );
for( unsigned p = 0; p < asPaths.size(); ++p ) for( unsigned p = 0; p < asPaths.size(); ++p )
@@ -347,7 +347,7 @@ try_element_again:
CString sCategory = ELEMENT_CATEGORY_STRING[category]; 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") ) switch( HOOKS->MessageBoxAbortRetryIgnore(sMessage, "MissingThemeElement") )
{ {
case ArchHooks::retry: case ArchHooks::retry:
@@ -356,7 +356,7 @@ try_element_again:
goto try_element_again; goto try_element_again;
case ArchHooks::ignore: case ArchHooks::ignore:
LOG->Warn( 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(), sCategory.c_str(),
sFileName.c_str(), sFileName.c_str(),
GetThemeDirFromName(m_sCurThemeName).c_str(), GetThemeDirFromName(m_sCurThemeName).c_str(),
@@ -369,7 +369,7 @@ try_element_again:
Cache[sFileName] = GetPathTo( category, "_missing" ); Cache[sFileName] = GetPathTo( category, "_missing" );
return Cache[sFileName]; return Cache[sFileName];
case ArchHooks::abort: 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(), sCategory.c_str(),
sFileName.c_str(), sFileName.c_str(),
GetThemeDirFromName(m_sCurThemeName).c_str(), GetThemeDirFromName(m_sCurThemeName).c_str(),
+2 -2
View File
@@ -25,8 +25,8 @@ Transition::Transition()
void Transition::Load( CString sBGAniDir ) void Transition::Load( CString sBGAniDir )
{ {
if( !sBGAniDir.empty() && sBGAniDir.Right(1) != SLASH ) if( !sBGAniDir.empty() && sBGAniDir.Right(1) != "/" )
sBGAniDir += SLASH; sBGAniDir += "/";
m_BGAnimation.LoadFromAniDir( sBGAniDir ); m_BGAnimation.LoadFromAniDir( sBGAniDir );