Engidea / FreeRoutingNew

FreeRouting stronger and better
68 stars 21 forks source link

does not take file name provided as argument #3

Closed aurabindo closed 7 years ago

aurabindo commented 7 years ago

Earlier versions worked straight out of the box in kicad, as it would open the design automatically. Now freerouting fails to open the file exported by kicad. Manually launching freeroute file.dsn did not open any files.

Engidea commented 7 years ago

I have committed a fix, note that apparently you need to declare the option as -de and then the filename If you may try it and report if it is good, it would be nice.

aurabindo commented 7 years ago

I tried the latest changes, and the ability to open designs directly from KiCad is back. However, the open file dialog also shows up first. Once I cancel the dialog, the actual design shows up!

Engidea commented 7 years ago

Added a small change so the open file dialog does not show up if a fname is given

wez commented 7 years ago

This diff seems to make the dialog behavior work correctly for me when launching this from kicad, and when running it from the command line:

diff --git a/src/freert/main/MainApplication.java b/src/freert/main/MainApplication.java
index 12344e5..c65b328 100644
--- a/src/freert/main/MainApplication.java
+++ b/src/freert/main/MainApplication.java
@@ -157,21 +157,19 @@ public class MainApplication extends JFrame
     */
    private DesignFile open_dialog()
    {
-      JFileChooser file_chooser = new JFileChooser(main_options.design_dir_name);
-      FileFilter file_filter = new FileFilter(DesignFile.all_file_extensions);
-      file_chooser.setFileFilter(file_filter);
-      file_chooser.showOpenDialog(null);
-
      File curr_design_file;

      if ( haveArgsFname() )
      {
        curr_design_file = new File (main_options.design_file_name );
+       return new DesignFile(stat, curr_design_file, null);
      }
-      else
-         {
+     JFileChooser file_chooser = new JFileChooser(main_options.design_dir_name);
+     FileFilter file_filter = new FileFilter(DesignFile.all_file_extensions);
+     file_chooser.setFileFilter(file_filter);
+
+     file_chooser.showOpenDialog(null);
      curr_design_file = file_chooser.getSelectedFile();
-         }

      if (curr_design_file == null) return null;
wez commented 7 years ago

Note that even with the latest build 51920fe2b66d91738f91f87d0e1db8970f7eebe8 this needs the patch above, otherwise it will pop open a dialog to choose the file, even if the -de parameter is provided

Engidea commented 7 years ago

Ok, adjusted, let me know if it is fine

wez commented 7 years ago

Looks good, thanks!