← Back to team overview

kicad-developers team mailing list archive

pcbnew fix: project file location

 

Hello everybody.

If pcbnew launched with <board_file>.brd as cmd-line argument (just filename, without absolute path), attempting to load file from current directory, pcbnew loads settings from kicad.pro in the templates directory instead of <board_file>.pro in the current directory.

It happens because pcbnew creates wxFileConfig with <board_file>.pro as local_file constructor argument. According to wxFileConfig documentation it means that config file location will be transformed to ~/.<board_filename>.pro which is not exist, and after failing to read values from this wrong location pcbnew falls back to loading default settings from kicad.pro

In the same launching eeschema correctly detects config file name as <absolute_path>/<sch_file>.pro

Attached path fixes bug by converting <board_file>.pro to <absolute_path>/<board_file>.pro in the same way as eeschema does.



--
Regards,
  Sergey A. Borshch            mailto: sb-sf@xxxxxxxxxxxxxxx
    SB ELDI ltd. Riga, Latvia
=== modified file 'pcbnew/pcbnew_config.cpp'
--- pcbnew/pcbnew_config.cpp	2013-02-02 17:39:59 +0000
+++ pcbnew/pcbnew_config.cpp	2013-03-08 21:48:19 +0000
@@ -237,6 +237,9 @@
 {
     wxFileName fn = aProjectFileName;
 
+    if( fn.IsRelative() )
+        fn.MakeAbsolute();
+
     if( fn.GetExt() != ProjectFileExtension )
         fn.SetExt( ProjectFileExtension );

Follow ups