Beanshell + Java : file path problem

Java, C++, C#, Delphi... - Using the UNO bridges
Post Reply
tanith
Posts: 2
Joined: Thu Apr 17, 2008 11:57 am

Beanshell + Java : file path problem

Post by tanith »

Hi everybody,

i'm asked to develop an extension for Calc in Beanshell.
The beanshell code import Java classes, and one of them had to use File.getPath function. My problem goes from the result of this function. The string is like : ${$SYSBINDIR/bootstrap.ini::UserInstallation}... And Java cannot work whith a such path.

So my question is :

Is there a way to convert ${$SYSBINDIR/bootstrap.ini::UserInstallation} into a windows path ?

thanks for answering
User avatar
Villeroy
Volunteer
Posts: 31279
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Beanshell + Java : file path problem

Post by Villeroy »

Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
tanith
Posts: 2
Joined: Thu Apr 17, 2008 11:57 am

Re: Beanshell + Java : file path problem

Post by tanith »

Your information explain the form of my path...but it seems that i need get a filepath without using this Bootstrap system.

Thanks for your answer
ms777
Volunteer
Posts: 177
Joined: Mon Oct 08, 2007 1:33 am

Re: Beanshell + Java : file path problem

Post by ms777 »

you do not have to use the bootstrap mechanism to use the services mentioned in the links above. Try this beanshell script ...

Code: Select all

sInput = "${$SYSBINDIR/bootstrap.ini::UserInstallation}";

oMacroExpander = XSCRIPTCONTEXT.getComponentContext().getValueByName("/singletons/com.sun.star.util.theMacroExpander");
sOutput = oMacroExpander.expandMacros(sInput);

javax.swing.JOptionPane.showMessageDialog(null, sOutput, sInput, javax.swing.JOptionPane.WARNING_MESSAGE);

return 0;
Post Reply