मैं एक निर्देशिका में ब्राउज़ करने के लिए एक ऐप में JFileChooser का उपयोग कर रहा हूं, हालांकि जब मैं निर्देशिका का चयन करता हूं तो यह मेरे द्वारा चुने गए फ़ोल्डर के ऊपर फ़ोल्डर का पथ देता है। यानी मैं चुनें "C: \ टेस्ट" और यह "C: \" रिटर्नJFileChooser getCurrentDirectory गलत वर्तमान निर्देशिका लौट रहा है?
यहाँ है कोड मैं
JFileChooser c = new JFileChooser();
c.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
int rVal = c.showSaveDialog(c);
if (rVal == JFileChooser.APPROVE_OPTION) {
txtDirectory.setText("");
CC_Test.MsgBox(c.getCurrentDirectory().toString());
txtDirectory.setText(c.getCurrentDirectory().toString());
}
if (rVal == JFileChooser.CANCEL_OPTION) {
txtDirectory.setText("");
}