已安装扩展的位置
From Apache OpenOffice Wiki
有时扩展开发者需要了解扩展安装位置的根目录路径,比如说读取一些额外数据。PackageInformationProvider
可以用给定的扩展标识符来获取的一个表示扩展安装路径的 URL。欲了解更多扩展标识符信息,请参阅 扩展标识符。详见 com.sun.star.deployment.PackageInformationProvider 并参阅 com.sun.star.deployment.XPackageInformationProvider。
... namespace css = com::sun::star; css::uno::Reference< css::uno::XComponentContext > mxContext; ... css::uno::Reference< css::deployment::XPackageInformationProvider > xInfoProvider( css::deployment::PackageInformationProvider::get( mxContext ) ); // "MY_PACKAGE_ID" is the identifier of the package whose location we want rtl::OUString sLocation = xInfoProvider->getPackageLocation( rtl::OUString::createFromAscii( "MY_PACKAGE_ID" ) ); ...
Content on this page is licensed under the Public Documentation License (PDL). |