0

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.

Vadym Kovalenko
  • 699
  • 1
  • 11
  • 27

1 Answers1

1

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.

Andres Almiray
  • 3,236
  • 18
  • 28