Problem with JFileChooser.getCurrentDirectory()
Hi @ all,
I have currently a Problem with the JFileChooser's Method "get CurrentDirectory().
I have overwritten the method approveSelection:
void approveSelection(){
System.out.println(chooser.getCurrentDirectory());
}
Now, the problem is...I get the Path not with the Current Directoy, but with the Parent of the Current Directoy!
Example: Current Directoy is: C:/Parent/Current
The selected Path is: C:/Parent
Thank you in advance,
Gab
[506 byte] By [
Gaba] at [2007-10-1 23:31:57]

Thank you, but it does not really solve my problem. There is no example with the getCurrentDirectory() Method, and I tried the example code they give on the tutorial and I have extended it to get the current Directory..but nothing, the program gives me the parent of the Current Directory...
Thank you in advance for some Help!
Gab
Gaba at 2007-7-15 14:14:46 >

I know this, and I already set it...but the problem is not to choose a directory, the problem is to get his truly Path, because the getCurrentDirectory() Method returns me the parent directory and the current Directory...
Gaba at 2007-7-15 14:14:46 >

I can't believe you've wasted 4 days over this.Read the String API and extract whatever part of the String you want. There's all kinds of methods there to help you, indexOf, substring...
I'm not wasting all the time over this problem, because i'm working on other things, but this is a problem I will have to solve, and it is better to know the solution ;)
I think you don't understand my problem. I get a Path from the getCurrentDirectory() Method, but it is "incomplete". The truly Current Directoy doesn't appear..just until his Parent Directory. And something like substring or something else from the String Class wouldn't really Help, I think.
Gaba at 2007-7-15 14:14:46 >

> I think you don't understand my problem. I get a Path from the getCurrentDirectory() Method, but it is "incomplete".
Your right I don't understand your problem. However I think it goes back to my original suggestion to read the tutorial to which you responded:
> There is no example with the getCurrentDirectory() Method
Thats because you should be using the getSelectedFile() method, which is what the tutorial uses.