diff --git a/src/AnnouncerManager.cpp b/src/AnnouncerManager.cpp index 8e7d045d29..888321f2d8 100644 --- a/src/AnnouncerManager.cpp +++ b/src/AnnouncerManager.cpp @@ -33,6 +33,7 @@ void AnnouncerManager::GetAnnouncerNames( vector& 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-- ) diff --git a/src/CharacterManager.cpp b/src/CharacterManager.cpp index 940edc35dc..7a0b6b6fa3 100644 --- a/src/CharacterManager.cpp +++ b/src/CharacterManager.cpp @@ -27,6 +27,7 @@ CharacterManager::CharacterManager() vector as; GetDirListing( CHARACTERS_DIR "*", as, true, true ); StripCvsAndSvn( as ); + StripMacResourceForks( as ); bool FoundDefault = false; for( unsigned i=0; im_szName + "/"; GetDirListing( sBaseSkinFolder + "*", AddTo, true ); StripCvsAndSvn( AddTo ); + StripMacResourceForks( AddTo ); } } diff --git a/src/RageUtil.cpp b/src/RageUtil.cpp index 70f3779765..2433a8335f 100644 --- a/src/RageUtil.cpp +++ b/src/RageUtil.cpp @@ -1189,6 +1189,16 @@ void StripCvsAndSvn( vector &vs ) RemoveIf( vs, CVSOrSVN ); } +static bool MacResourceFork( const RString& s ) +{ + return s.Left(2).EqualsNoCase("._"); +} + +void StripMacResourceForks( vector &vs ) +{ + RemoveIf( vs, MacResourceFork ); +} + /* path is a .redir pathname. Read it and return the real one. */ RString DerefRedir( const RString &_path ) { diff --git a/src/RageUtil.h b/src/RageUtil.h index e96a026c29..a2fe6f4773 100644 --- a/src/RageUtil.h +++ b/src/RageUtil.h @@ -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 &vs ); // remove all items that end in "cvs" +void StripCvsAndSvn( vector &vs ); // Removes various versioning system metafolders. +void StripMacResourceForks( vector &vs ); // Removes files starting with "._" RString DerefRedir( const RString &sPath ); bool GetFileContents( const RString &sPath, RString &sOut, bool bOneLine = false ); diff --git a/src/ScreenOptionsExportPackage.cpp b/src/ScreenOptionsExportPackage.cpp index c7231e2514..b47e4f2e10 100644 --- a/src/ScreenOptionsExportPackage.cpp +++ b/src/ScreenOptionsExportPackage.cpp @@ -45,6 +45,7 @@ void ScreenOptionsExportPackage::BeginScreen() vector 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 OptionRowHandlers; diff --git a/src/SongManager.cpp b/src/SongManager.cpp index 3f02d1f041..da43cfce28 100644 --- a/src/SongManager.cpp +++ b/src/SongManager.cpp @@ -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 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 diff --git a/src/ThemeManager.cpp b/src/ThemeManager.cpp index 3159e16fce..f0af2ff534 100644 --- a/src/ThemeManager.cpp +++ b/src/ThemeManager.cpp @@ -178,6 +178,7 @@ void ThemeManager::GetThemeNames( vector& AddTo ) { GetDirListing( SpecialFiles::THEMES_DIR + "*", AddTo, true ); StripCvsAndSvn( AddTo ); + StripMacResourceForks( AddTo ); } void ThemeManager::GetSelectableThemeNames( vector& 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