Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8123775

Gtk: FileChooser save dialog do not use extension to decide if overwrite confirmation is needed on Linux

    XMLWordPrintable

    Details

      Description

      Touch file /tmp/existing.fxml on your system.
      Then run the code below and in the File Chooser dialog enter 'existing' without the file extension.
      Press Save button: on Mac and Win you get an overwrite confirmation dialog, then if you confirm the file returned is /tmp/existing.fxml.
      On Linux you get no overwrite confirmation dialog and the file returned is /tmp/existing, the extension part is missing.

      package javaapplication1;

      import java.io.File;
      import javafx.application.Application;
      import static javafx.application.Application.launch;
      import javafx.stage.FileChooser;
      import javafx.stage.FileChooserBuilder;
      import javafx.stage.FileChooser.ExtensionFilter;
      import javafx.stage.Stage;

      public class JavaApplication1 extends Application {

          @Override
          public void start(Stage primaryStage) {
              FileChooser fileChooser = FileChooserBuilder.create().initialDirectory(new File("/tmp")).extensionFilters(new ExtensionFilter("fxml", "*.fxml")).build();
              File ignored = fileChooser.showSaveDialog(primaryStage);
              System.out.println("File returned by chooser is " + ignored);
          }

          public static void main(String[] args) {
              launch(args);
          }
      }

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              azvegint Alexander Zvegintsev
              Reporter:
              yjoan Yves Joan (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Imported: