This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
Summary: | Env.getCurrentDirectory consistently gives wrong path on MS Windows | ||
---|---|---|---|
Product: | platform | Reporter: | tomwheeler <tomwheeler> |
Component: | Launchers&CLI | Assignee: | Jaroslav Tulach <jtulach> |
Status: | VERIFIED FIXED | ||
Severity: | normal | ||
Priority: | P3 | ||
Version: | 6.x | ||
Hardware: | PC | ||
OS: | Windows XP | ||
Issue Type: | DEFECT | Exception Reporter: | |
Bug Depends on: | 168465 | ||
Bug Blocks: | |||
Attachments: |
Suite which illustrates the problem
Recompiled app.exe. Tom please verify that it works for you The trivial, but incompatible fix |
Description
tomwheeler
2010-08-23 22:13:00 UTC
Created attachment 101617 [details]
Suite which illustrates the problem
Just changing CWD is going to incompatible for example for bug 168465. Created attachment 101698 [details]
Recompiled app.exe. Tom please verify that it works for you
Created attachment 101699 [details]
The trivial, but incompatible fix
I will need to come up with some more compatible fix. For example I could also modify app.conf to contain some information or command line option whether the current directory shall remain where it is or be moved to basedir.
Thanks for looking at this. I have confirmed that the attached app.exe yields the desired behavior. I also understand that some applications may depend on the current behavior of Env.getCurrentDirectory() and changing it would be compatible. Based on this, it would be totally acceptable to leave the current behavior and add a new method (perhaps Env.getExecutionDirectory()) which provides access to the directory from which the command was invoked, plus a tiny bit of Javadoc which explains how these two methods differ on Windows system. If you don't want to add a new method to Env, maybe the launcher could set a Java system property that points to this location. Your proposed solution is also fine. My goal is simply to resolve relative file paths based on the directory from which the command was invoked. Really, pretty much any solution which allows that -- even if I need to write a little extra code -- is OK with me. Instead of "changing it would be compatible" I meant "changing it would be INcompatible". I am off to get some more coffee now... Integrated into 'main-golden', will be available in build *201009010001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress) Changeset: http://hg.netbeans.org/main/rev/f82e145924c7 User: Jaroslav Tulach <jtulach@netbeans.org> Log: #189791: Pass current directory in netbeans.user.dir property Verified using current main-golden build. Thanks so much for the fix! |