Hi, for me this works fine on windows:
String sURL = getPackageLocation(xComponentContext, "my.extension");
//
file:///C:/Program%20Files/OpenOffice.org%203/program/../share/uno_packages/cache/uno_packages/6A32.tmp_/myextension.oxt
convertURL(xComponentContext).getSystemPathFromFileURL(sURL);
// C:\Program Files\OpenOffice.org
3\program\..\share\uno_packages\cache\uno_packages\6A32.tmp_\myextension.oxt
public static String getPackageLocation(
final XComponentContext xComponentContext, final String
identifier) {
return PackageInformationProvider.get(xComponentContext)
.getPackageLocation(identifier);
}
public static XFileIdentifierConverter convertURL(final
XComponentContext xComponentContext) {
try {
return toFileIdentifierConverter(UnoBaseHelper
.createInstanceWithContext(xComponentContext,
"com.sun.star.ucb.FileContentProvider"));
} catch (final Exception e) {
e.printStackTrace();
Log.error(e.getMessage());
}
return null;
}
public static XFileIdentifierConverter toFileIdentifierConverter(
final Object obj) {
if (obj != null)
return (XFileIdentifierConverter)
UnoRuntime.queryInterface(
XFileIdentifierConverter.class, obj);
return null;
}
Oliver
--
GnuPG key 0xCFD04A45: 8822 057F 4956 46D3 352C 1A06 4E2C AB40 CFD0 4A45
signature.asc
Description: OpenPGP digital signature
