AppBundler: wrong working directory

Tobias Bley tobi at ultramixer.com
Wed Feb 29 00:01:06 PST 2012


Hi Greg,

thanks for your ultra fast response :)

I think it's important to have the same behavior between JDK6 and JDK7 so that there is no need to rewrite my application.

Currently if I want to load a resource from the "root" of my app I can call simply: new File("./myresource.png")

The current JavaAppLauncher from Apple (JDK6) provides the possibility to set the working directory in the plist-file. That's a good solution. So in my opinion you should extend the ant task in this direction...

Best regards,
Tobi


-- 
 Tobias Bley
 Chief Executive Officer

--------------------------------------------------------

 UltraMixer Digital Audio Solutions
 Schillerstraße  29
 D-01326 Dresden
 Germany

--------------------------------------------------------
 bley at ultramixer.com   http://www.ultramixer.com





Am 28.02.2012 um 18:30 schrieb Greg Brown <greg.x.brown at oracle.com>:

> Hi Tobi,
> 
> You are correct - the Ant bundler doesn't currently set the working directory. I have proposed modifying the launcher app to set the working directory to the bundle root:
> 
> http://mail.openjdk.java.net/pipermail/macosx-port-dev/2012-February/003289.html
> 
> However, I'm not sure that would have any effect on the behavior you are seeing. The launcher is now calling JLI_Launch() to start the JVM rather than calling into JNI directly. JLI_Launch() may be setting the working directory to the user's home directory (which may be intentional - I'm not sure yet).
> 
> What impact does this have on your app? Is it something you could work around if it turns out that user.home is the correct default?
> 
> G
> 
> On Feb 28, 2012, at 11:42 AM, Tobias Bley wrote:
> 
>> Hi,
>> 
>> When I create an *.app with the new AppBundler ant task I don't get the right working directory.
>> 
>> File workingDirectory = new File(".").getAbsolutePath();
>> 
>> => /Users/<username>
>> 
>> 
>> When I try this with Apples JavaAppLauncher with JDK6 I get
>> 
>> => <path-to-app-bundle>/Contents/Resources/
>> 
>> I suppose the problem is that the AppBundler ant task does not set the working directory into the app-bundle...
>> 
>> Any suggestions?
>> 
>> Best regards,
>> Tobi
>> 
>> 
>> 
>> 
>> 
> 



More information about the macosx-port-dev mailing list