INTEGRATION: CWS unopkg1 (1.89.10); FILE MERGED
2004/03/10 10:15:54 mav 1.89.10.1: #i26283# do not hide META-INF folder
This commit is contained in:
parent
672d5cedb3
commit
e6810dba1c
1 changed files with 121 additions and 93 deletions
|
@ -2,9 +2,9 @@
|
|||
*
|
||||
* $RCSfile: ZipPackage.cxx,v $
|
||||
*
|
||||
* $Revision: 1.89 $
|
||||
* $Revision: 1.90 $
|
||||
*
|
||||
* last change: $Author: hr $ $Date: 2004-02-04 12:28:25 $
|
||||
* last change: $Author: hr $ $Date: 2004-04-13 12:22:22 $
|
||||
*
|
||||
* The Contents of this file are made available subject to the terms of
|
||||
* either of the following licenses
|
||||
|
@ -365,12 +365,20 @@ void ZipPackage::getZipFileContents()
|
|||
pPkgStream->doSetParent( pCurrent, sal_True );
|
||||
}
|
||||
}
|
||||
const OUString sManifest (RTL_CONSTASCII_USTRINGPARAM( "META-INF/manifest.xml") );
|
||||
if (hasByHierarchicalName( sManifest ) )
|
||||
|
||||
const OUString sMeta ( RTL_CONSTASCII_USTRINGPARAM ( "META-INF" ) );
|
||||
if ( xRootFolder->hasByName( sMeta ) )
|
||||
{
|
||||
const OUString sManifest (RTL_CONSTASCII_USTRINGPARAM( "manifest.xml") );
|
||||
|
||||
try {
|
||||
Reference < XUnoTunnel > xTunnel;
|
||||
Any aAny = getByHierarchicalName( sManifest );
|
||||
Reference< XUnoTunnel > xTunnel;
|
||||
Any aAny = xRootFolder->getByName( sMeta );
|
||||
aAny >>= xTunnel;
|
||||
Reference< XNameContainer > xMetaInfFolder( xTunnel, UNO_QUERY );
|
||||
if ( xMetaInfFolder.is() && xMetaInfFolder->hasByName( sManifest ) )
|
||||
{
|
||||
aAny = xMetaInfFolder->getByName( sManifest );
|
||||
aAny >>= xTunnel;
|
||||
Reference < XActiveDataSink > xSink (xTunnel, UNO_QUERY);
|
||||
if (xSink.is())
|
||||
|
@ -467,6 +475,10 @@ void ZipPackage::getZipFileContents()
|
|||
else
|
||||
VOS_ENSURE ( 0, "Couldn't get a ManifestReader!" ); // throw RuntimeException?
|
||||
}
|
||||
|
||||
// now hide the manifest.xml file from user
|
||||
xMetaInfFolder->removeByName( sManifest );
|
||||
}
|
||||
}
|
||||
catch( Exception& )
|
||||
{
|
||||
|
@ -475,10 +487,6 @@ void ZipPackage::getZipFileContents()
|
|||
}
|
||||
}
|
||||
|
||||
const OUString sMeta ( RTL_CONSTASCII_USTRINGPARAM ( "META-INF" ) );
|
||||
if ( xRootFolder->hasByName( sMeta ) )
|
||||
xRootFolder->removeByName( sMeta );
|
||||
|
||||
const OUString sMimetype ( RTL_CONSTASCII_USTRINGPARAM ( "mimetype" ) );
|
||||
if ( xRootFolder->hasByName( sMimetype ) )
|
||||
xRootFolder->removeByName( sMimetype );
|
||||
|
@ -879,12 +887,32 @@ sal_Bool ZipPackage::writeFileIsTemp()
|
|||
aZipOut.setMethod(DEFLATED);
|
||||
aZipOut.setLevel(DEFAULT_COMPRESSION);
|
||||
|
||||
// Remove the old META-INF directory (if there is one) as the
|
||||
// manifest will be re-generated and the META-INF directory implicitly
|
||||
// created
|
||||
// Remove the old manifest.xml file as the
|
||||
// manifest will be re-generated and the
|
||||
// META-INF directory implicitly created if does not exist
|
||||
const OUString sMeta ( RTL_CONSTASCII_USTRINGPARAM ( "META-INF" ) );
|
||||
if (xRootFolder->hasByName( sMeta ) )
|
||||
xRootFolder->removeByName( sMeta );
|
||||
try {
|
||||
if ( xRootFolder->hasByName( sMeta ) )
|
||||
{
|
||||
const OUString sManifest (RTL_CONSTASCII_USTRINGPARAM( "manifest.xml") );
|
||||
|
||||
Reference< XUnoTunnel > xTunnel;
|
||||
Any aAny = xRootFolder->getByName( sMeta );
|
||||
aAny >>= xTunnel;
|
||||
Reference< XNameContainer > xMetaInfFolder( xTunnel, UNO_QUERY );
|
||||
if ( xMetaInfFolder.is() && xMetaInfFolder->hasByName( sManifest ) )
|
||||
xMetaInfFolder->removeByName( sManifest );
|
||||
}
|
||||
}
|
||||
catch (::com::sun::star::uno::RuntimeException & r )
|
||||
{
|
||||
VOS_ENSURE( 0, "Error preparing ZIP file for writing to disk" );
|
||||
throw WrappedTargetException(
|
||||
OUString( RTL_CONSTASCII_USTRINGPARAM ( "Error preparing ZIP file for writing to disk!" ) ),
|
||||
static_cast < OWeakObject * > ( this ),
|
||||
makeAny( r ) );
|
||||
}
|
||||
|
||||
|
||||
// Write a magic file with mimetype
|
||||
WriteMimetypeMagicFile( aZipOut );
|
||||
|
|
Loading…
Reference in a new issue