working on zip reading

This commit is contained in:
Chris Danford
2006-01-21 21:45:59 +00:00
parent 836e12297e
commit d773b2443f
@@ -68,6 +68,7 @@ static bool CompareStringNoCase( const RString &s1, const RString &s2 )
return s1.CompareNoCase( s2 ) < 0; return s1.CompareNoCase( s2 ) < 0;
} }
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 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:" ); static LocalizedString YOU_HAVE_CHOSEN_TO_INSTALL ( "CSMPackageInstallDlg", "You have chosen to install the package:" );
static LocalizedString THIS_PACKAGE_CONTAINS ( "CSMPackageInstallDlg", "This package contains the following files:" ); static LocalizedString THIS_PACKAGE_CONTAINS ( "CSMPackageInstallDlg", "This package contains the following files:" );
@@ -86,12 +87,18 @@ BOOL CSMPackageInstallDlg::OnInitDialog()
DialogUtil::SetHeaderFont( *this, IDC_STATIC_HEADER_TEXT ); DialogUtil::SetHeaderFont( *this, IDC_STATIC_HEADER_TEXT );
// mount the zip // mount the zip
RageFileDriverZip fileDriver; RageFileOsAbsolute file;
int iErr; if( !file.Open(m_sPackagePath) )
if( !fileDriver.Open(m_sPackagePath, RageFile::READ, iErr) )
{ {
AfxMessageBox( ssprintf(IS_NOT_A_VALID_ZIP.GetValue(), m_sPackagePath), MB_ICONSTOP ); MessageBox( ssprintf(COULD_NOT_OPEN_FILE.GetValue(),m_sPackagePath.c_str()) );
exit( 1 ); return FALSE;
}
RageFileDriverZip zip;
if( zip.Load(&file) );
{
MessageBox( ssprintf(IS_NOT_A_VALID_ZIP.GetValue(),m_sPackagePath.c_str()) );
return FALSE;
} }
// //
@@ -114,7 +121,7 @@ BOOL CSMPackageInstallDlg::OnInitDialog()
// //
{ {
vector<RString> vs; vector<RString> vs;
GetDirListingRecursive( &fileDriver, "", "*", vs ); GetDirListingRecursive( &zip, "", "*", vs );
CEdit* pEdit2 = (CEdit*)GetDlgItem(IDC_EDIT_MESSAGE2); CEdit* pEdit2 = (CEdit*)GetDlgItem(IDC_EDIT_MESSAGE2);
RString sText = "\t" + join( "\r\n\t", vs ); RString sText = "\t" + join( "\r\n\t", vs );
pEdit2->SetWindowText( sText ); pEdit2->SetWindowText( sText );