Save file dialog in griffon

175 Views Asked by At

i have a save file dialog in my griffon app. the code is like this:

    String filename = siteCode+'-'+model.currentClient.name+'-'+computerName+'-'+date+'.csv'
    File selFile = new File(filename)
    def fc = new JFileChooser()
    fc.setSelectedFile(selFile)
    fc.showSaveDialog()



    BufferedWriter out = new BufferedWriter(new FileWriter(selFile));

The problem is, regardless the path i choose to save file at, it alsways goes to the "Staging" directory in my app's folder.

1

There are 1 best solutions below

0
On BEST ANSWER

Could it be that you're not reading back the selected file from the dialog but reusing the selFile variable? Make sure you call fc.getSelectedFile() instead.