Fail early if getPackageLocation fails; plus clean-up
Change-Id: Ifa7d589e7854fed9cd9ca2a3f3c987179b60199f
This commit is contained in:
@@ -44,7 +44,7 @@
|
|||||||
#include "com/sun/star/io/XInputStream.hpp"
|
#include "com/sun/star/io/XInputStream.hpp"
|
||||||
#include "com/sun/star/uno/XComponentContext.hpp"
|
#include "com/sun/star/uno/XComponentContext.hpp"
|
||||||
#include "com/sun/star/awt/FontDescriptor.hpp"
|
#include "com/sun/star/awt/FontDescriptor.hpp"
|
||||||
#include "com/sun/star/deployment/XPackageInformationProvider.hpp"
|
#include "com/sun/star/deployment/PackageInformationProvider.hpp"
|
||||||
#include "com/sun/star/beans/XMaterialHolder.hpp"
|
#include "com/sun/star/beans/XMaterialHolder.hpp"
|
||||||
#include "com/sun/star/rendering/PathCapType.hpp"
|
#include "com/sun/star/rendering/PathCapType.hpp"
|
||||||
#include "com/sun/star/rendering/PathJoinType.hpp"
|
#include "com/sun/star/rendering/PathJoinType.hpp"
|
||||||
@@ -999,24 +999,21 @@ bool xpdf_ImportFromFile( const ::rtl::OUString& rUR
|
|||||||
if( checkEncryption( aSysUPath, xIHdl, aPwd, bIsEncrypted, aDocName ) == false )
|
if( checkEncryption( aSysUPath, xIHdl, aPwd, bIsEncrypted, aDocName ) == false )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
rtl::OUStringBuffer converterURL = rtl::OUString("xpdfimport");
|
// Retrieve package location URL, xpdfimport executable is located there:
|
||||||
|
OUString location(
|
||||||
// retrieve package location url (xpdfimport executable is located there)
|
deployment::PackageInformationProvider::get(xContext)->
|
||||||
// ---------------------------------------------------
|
getPackageLocation(PDFI_IMPL_IDENTIFIER));
|
||||||
uno::Reference<deployment::XPackageInformationProvider> xProvider(
|
if (location.isEmpty()) {
|
||||||
xContext->getValueByName(
|
SAL_WARN(
|
||||||
rtl::OUString("/singletons/com.sun.star.deployment.PackageInformationProvider")),
|
"sdext.pdfimport",
|
||||||
uno::UNO_QUERY);
|
"getPackageLocation(" PDFI_IMPL_IDENTIFIER ") failed");
|
||||||
if( xProvider.is() )
|
return false;
|
||||||
{
|
|
||||||
converterURL.insert(
|
|
||||||
0,
|
|
||||||
rtl::OUString("/"));
|
|
||||||
converterURL.insert(
|
|
||||||
0,
|
|
||||||
xProvider->getPackageLocation(
|
|
||||||
rtl::OUString::createFromAscii(PDFI_IMPL_IDENTIFIER)));
|
|
||||||
}
|
}
|
||||||
|
rtl::OUStringBuffer converterURL(location);
|
||||||
|
if (!location.endsWith("/")) {
|
||||||
|
converterURL.append('/');
|
||||||
|
}
|
||||||
|
converterURL.append("xpdfimport");
|
||||||
|
|
||||||
// spawn separate process to keep LGPL/GPL code apart.
|
// spawn separate process to keep LGPL/GPL code apart.
|
||||||
// ---------------------------------------------------
|
// ---------------------------------------------------
|
||||||
|
Reference in New Issue
Block a user