diff --git a/stepmania/src/smpackage/SMPackageInstallDlg.cpp b/stepmania/src/smpackage/SMPackageInstallDlg.cpp index bc7ae6a4d0..0b3d121fba 100644 --- a/stepmania/src/smpackage/SMPackageInstallDlg.cpp +++ b/stepmania/src/smpackage/SMPackageInstallDlg.cpp @@ -69,6 +69,13 @@ static bool CompareStringNoCase( const RString &s1, const RString &s2 ) return s1.CompareNoCase( s2 ) < 0; } +void GetSmzipFilesToExtract( RageFileDriver &zip, vector &vsOut ) +{ + GetDirListingRecursive( &zip, "/", "*", vsOut ); + SMPackageUtil::StripIgnoredSmzipFiles( vsOut ); +} + + static LocalizedString COULD_NOT_OPEN_FILE ( "CSMPackageInstallDlg", "Could not open file '%s'." ); static LocalizedString IS_NOT_A_VALID_ZIP ( "CSMPackageInstallDlg", "'%s' is not a valid zip archive." ); static LocalizedString YOU_HAVE_CHOSEN_TO_INSTALL ( "CSMPackageInstallDlg", "You have chosen to install the package:" ); @@ -122,7 +129,7 @@ BOOL CSMPackageInstallDlg::OnInitDialog() // { vector vs; - GetDirListingRecursive( &zip, "/", "*", vs ); + GetSmzipFilesToExtract( zip, vs ); CEdit* pEdit2 = (CEdit*)GetDlgItem(IDC_EDIT_MESSAGE2); RString sText = "\t" + join( "\r\n\t", vs ); pEdit2->SetWindowText( sText ); @@ -314,7 +321,7 @@ void CSMPackageInstallDlg::OnOK() // Unzip the SMzip package into the installation folder vector vs; - GetDirListingRecursive( &zip, "/", "*", vs ); + GetSmzipFilesToExtract( zip, vs ); for( unsigned i=0; iTrace( "Extracting: "+sFile ); - // skip extracting "thumbs.db" files - if( Basename(sFile).CompareNoCase("thumbs.db") == 0 ) - continue; - RString sError; { int iErr; diff --git a/stepmania/src/smpackage/SMPackageUtil.cpp b/stepmania/src/smpackage/SMPackageUtil.cpp index fbfee8844f..5b3e45abc9 100644 --- a/stepmania/src/smpackage/SMPackageUtil.cpp +++ b/stepmania/src/smpackage/SMPackageUtil.cpp @@ -215,6 +215,23 @@ RString SMPackageUtil::GetLanguageCodeFromDisplayString( const RString &sDisplay return s; } +void SMPackageUtil::StripIgnoredSmzipFiles( vector &vsFilesInOut ) +{ + for( int i=vsFilesInOut.size()-1; i>=0; i-- ) + { + const RString &sFile = vsFilesInOut[i]; + + bool bEraseThis = false; + bEraseThis |= EndsWith( sFile, "smzip.ctl" ); + bEraseThis |= EndsWith( sFile, ".old" ); + bEraseThis |= EndsWith( sFile, "Thumbs.db" ); + bEraseThis |= (sFile.find("CVS") != string::npos); + + if( bEraseThis ) + vsFilesInOut.erase( vsFilesInOut.begin()+i ); + } +} + bool SMPackageUtil::DoesOsAbsoluteFileExist( const RString &sOsAbsoluteFile ) { #if defined(WIN32) diff --git a/stepmania/src/smpackage/SmpackageExportDlg.cpp b/stepmania/src/smpackage/SmpackageExportDlg.cpp index b38ad8142d..22f2f22ccb 100644 --- a/stepmania/src/smpackage/SmpackageExportDlg.cpp +++ b/stepmania/src/smpackage/SmpackageExportDlg.cpp @@ -133,6 +133,7 @@ static bool ExportPackage( const RString &sPackageName, const RString &sSourceIn if( sDir.Right(1) != "/" ) sDir += "/"; GetDirListingRecursive( &fileDriver, sDir, "*", asFilePaths ); + SMPackageUtil::StripIgnoredSmzipFiles( asFilePaths ); } } @@ -177,12 +178,6 @@ static bool ExportPackage( const RString &sPackageName, const RString &sSourceIn { RString sFilePath = asFilePaths[j]; - // don't export "thumbs.db" files or "CVS" folders - if( sFilePath.find("CVS") != string::npos ) - continue; // skip - if( sFilePath.find("Thumbs.db") != string::npos ) - continue; // skip - RString sExt = GetExtension( sFilePath ); bool bUseCompression = true; if( sExt.CompareNoCase("avi")==0 || diff --git a/stepmania/src/smpackage/smpackageUtil.h b/stepmania/src/smpackage/smpackageUtil.h index 07038cd7d7..2074b83bd9 100644 --- a/stepmania/src/smpackage/smpackageUtil.h +++ b/stepmania/src/smpackage/smpackageUtil.h @@ -23,6 +23,8 @@ namespace SMPackageUtil RString GetLanguageDisplayString( const RString &sIsoCode ); RString GetLanguageCodeFromDisplayString( const RString &sDisplayString ); + void StripIgnoredSmzipFiles( vector &vsFilesInOut ); + bool GetFileContentsOsAbsolute( const RString &sAbsoluteOsFile, RString &sOut ); bool DoesOsAbsoluteFileExist( const RString &sOsAbsoluteFile );