Difference between revisions of "Documentation/DevGuide/Extensions/Location of Installed Extensions"

From Apache OpenOffice Wiki
Jump to: navigation, search
m (Robot: Changing Category:Documentation/Developers Guide/Extensions)
m
Line 5: Line 5:
 
|NextPage=Documentation/DevGuide/Extensions/Extension Layers
 
|NextPage=Documentation/DevGuide/Extensions/Extension Layers
 
}}
 
}}
 +
[[zh:Zh/Documentation/DevGuide/Extensions/Location of Installed Extensions]]
 
{{DISPLAYTITLE:Location of Installed Extensions}}
 
{{DISPLAYTITLE:Location of Installed Extensions}}
 
Sometimes an extension developer needs to know the path to the root of his installed extension e.g. to load some additional data. You can use the singleton <code>PackageInformationProvider</code> to get an URL for an installed extension with a given Extension Identifier. For more information about Extension Identifiers see [[Documentation/DevGuide/Extensions/Extension Identifiers|Extension Identifiers]]. For more information see <idl>com.sun.star.deployment.PackageInformationProvider</idl> and have a look at <idl>com.sun.star.deployment.XPackageInformationProvider</idl>.
 
Sometimes an extension developer needs to know the path to the root of his installed extension e.g. to load some additional data. You can use the singleton <code>PackageInformationProvider</code> to get an URL for an installed extension with a given Extension Identifier. For more information about Extension Identifiers see [[Documentation/DevGuide/Extensions/Extension Identifiers|Extension Identifiers]]. For more information see <idl>com.sun.star.deployment.PackageInformationProvider</idl> and have a look at <idl>com.sun.star.deployment.XPackageInformationProvider</idl>.

Revision as of 05:27, 4 September 2008

Sometimes an extension developer needs to know the path to the root of his installed extension e.g. to load some additional data. You can use the singleton PackageInformationProvider to get an URL for an installed extension with a given Extension Identifier. For more information about Extension Identifiers see Extension Identifiers. For more information see com.sun.star.deployment.PackageInformationProvider and have a look at 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 where we want to get location from
  rtl::OUString sLocation = xInfoProvider->getPackageLocation( 
  rtl::OUString::createFromAscii( "MY_PACKAGE_ID" ) );
  ...
Content on this page is licensed under the Public Documentation License (PDL).
Personal tools
In other languages