add StripMacResourceForks(); hopefully prevents things like issue 178 ( http://ssc.ajworld.net/sm-ssc/bugtracker/view.php?id=178 ) from happening again

This commit is contained in:
AJ Kelly
2010-08-26 00:49:40 -05:00
parent 705bf9b778
commit 20a1802758
8 changed files with 23 additions and 1 deletions
+1
View File
@@ -33,6 +33,7 @@ void AnnouncerManager::GetAnnouncerNames( vector<RString>& AddTo )
GetDirListing( ANNOUNCERS_DIR+"*", AddTo, true );
StripCvsAndSvn( AddTo );
StripMacResourceForks( AddTo );
// strip out the empty announcer folder
for( int i=AddTo.size()-1; i>=0; i-- )
+1
View File
@@ -27,6 +27,7 @@ CharacterManager::CharacterManager()
vector<RString> as;
GetDirListing( CHARACTERS_DIR "*", as, true, true );
StripCvsAndSvn( as );
StripMacResourceForks( as );
bool FoundDefault = false;
for( unsigned i=0; i<as.size(); i++ )
+2
View File
@@ -79,6 +79,7 @@ void NoteSkinManager::RefreshNoteSkinData( const Game* pGame )
GetDirListing( sBaseSkinFolder + "*", asNoteSkinNames, true );
StripCvsAndSvn( asNoteSkinNames );
StripMacResourceForks( asNoteSkinNames );
g_mapNameToData.clear();
for( unsigned j=0; j<asNoteSkinNames.size(); j++ )
@@ -227,6 +228,7 @@ void NoteSkinManager::GetAllNoteSkinNamesForGame( const Game *pGame, vector<RStr
RString sBaseSkinFolder = SpecialFiles::NOTESKINS_DIR + pGame->m_szName + "/";
GetDirListing( sBaseSkinFolder + "*", AddTo, true );
StripCvsAndSvn( AddTo );
StripMacResourceForks( AddTo );
}
}
+10
View File
@@ -1189,6 +1189,16 @@ void StripCvsAndSvn( vector<RString> &vs )
RemoveIf( vs, CVSOrSVN );
}
static bool MacResourceFork( const RString& s )
{
return s.Left(2).EqualsNoCase("._");
}
void StripMacResourceForks( vector<RString> &vs )
{
RemoveIf( vs, MacResourceFork );
}
/* path is a .redir pathname. Read it and return the real one. */
RString DerefRedir( const RString &_path )
{
+2 -1
View File
@@ -494,7 +494,8 @@ bool BeginsWith( const RString &sTestThis, const RString &sBeginning );
bool EndsWith( const RString &sTestThis, const RString &sEnding );
RString URLEncode( const RString &sStr );
void StripCvsAndSvn( vector<RString> &vs ); // remove all items that end in "cvs"
void StripCvsAndSvn( vector<RString> &vs ); // Removes various versioning system metafolders.
void StripMacResourceForks( vector<RString> &vs ); // Removes files starting with "._"
RString DerefRedir( const RString &sPath );
bool GetFileContents( const RString &sPath, RString &sOut, bool bOneLine = false );
+2
View File
@@ -45,6 +45,7 @@ void ScreenOptionsExportPackage::BeginScreen()
vector<RString> vs;
GetDirListing( SpecialFiles::COURSES_DIR + "*", vs, true, true );
StripCvsAndSvn( vs );
StripMacResourceForks( vs );
FOREACH_CONST( RString, vs, s )
{
m_vsPossibleDirsToExport.push_back( *s );
@@ -64,6 +65,7 @@ void ScreenOptionsExportPackage::BeginScreen()
}
StripCvsAndSvn( m_vsPossibleDirsToExport );
StripMacResourceForks( m_vsPossibleDirsToExport );
}
vector<OptionRowHandler*> OptionRowHandlers;
+3
View File
@@ -230,6 +230,7 @@ void SongManager::LoadStepManiaSongDir( RString sDir, LoadingWindow *ld )
GetDirListing( sDir+"*", arrayGroupDirs, true );
SortRStringArray( arrayGroupDirs );
StripCvsAndSvn( arrayGroupDirs );
StripMacResourceForks( arrayGroupDirs );
FOREACH_CONST( RString, arrayGroupDirs, s ) // foreach dir in /Songs/
{
@@ -241,6 +242,7 @@ void SongManager::LoadStepManiaSongDir( RString sDir, LoadingWindow *ld )
vector<RString> arraySongDirs;
GetDirListing( sDir+sGroupDirName + "/*", arraySongDirs, true, true );
StripCvsAndSvn( arraySongDirs );
StripMacResourceForks( arraySongDirs );
SortRStringArray( arraySongDirs );
LOG->Trace("Attempting to load %i songs from \"%s\"", int(arraySongDirs.size()),
@@ -731,6 +733,7 @@ void SongManager::InitCoursesFromDisk( LoadingWindow *ld )
// Find all group directories in Courses dir
GetDirListing( *sDir + "*", vsCourseGroupNames, true, true );
StripCvsAndSvn( vsCourseGroupNames );
StripMacResourceForks( vsCourseGroupNames );
}
// Search for courses both in COURSES_DIR and in subdirectories
+2
View File
@@ -178,6 +178,7 @@ void ThemeManager::GetThemeNames( vector<RString>& AddTo )
{
GetDirListing( SpecialFiles::THEMES_DIR + "*", AddTo, true );
StripCvsAndSvn( AddTo );
StripMacResourceForks( AddTo );
}
void ThemeManager::GetSelectableThemeNames( vector<RString>& AddTo )
@@ -462,6 +463,7 @@ void ThemeManager::RunLuaScripts( const RString &sMask )
GetDirListing( sThemeDir + "Scripts/*", arrayScriptDirs, true );
SortRStringArray( arrayScriptDirs );
StripCvsAndSvn( arrayScriptDirs );
StripMacResourceForks( arrayScriptDirs );
FOREACH_CONST( RString, arrayScriptDirs, s ) // foreach dir in /Scripts/
{
// Find all Lua files in this directory, add them to asElementPaths