Fix an issue in LoadPlugins(bundlepath=None) python method (Windows specific).

For some obscure (for me) reason, the path separators in bundlepath are seen as escape seq, and the path can be incorrectly handled
(when \n or \r are found in this string).
it happens only for this path, not for other paths in LoadPlugins.
For bundlepath parameter, unix separator is now used.

Fixes: lp:1766879
https://bugs.launchpad.net/kicad/+bug/1766879
This commit is contained in:
jean-pierre charras 2018-04-27 14:03:33 +02:00
parent 7d9dea7897
commit 986b90424b
2 changed files with 13 additions and 4 deletions

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2012 NBEE Embedded Systems, Miguel Angel Ajo <miguelangel@nbee.es>
* Copyright (C) 1992-2016 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 1992-2018 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -450,7 +450,14 @@ wxString PyScriptingPath()
wxFileName scriptPath( path );
scriptPath.MakeAbsolute();
return scriptPath.GetFullPath();
// Convert '\' to '/' in path, because later python script read \n or \r
// as escaped sequence, and create issues. Moreover, python uses unix notation in paths
// in many cases.
// It can happen on Windows.
path = scriptPath.GetFullPath();
path.Replace( '\\', '/' );
return path;
}
wxString PyPluginsPath()

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2012 NBEE Embedded Systems, Miguel Angel Ajo <miguelangel@nbee.es>
* Copyright (C) 1992-2017 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 1992-2018 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -168,9 +168,11 @@ def LoadPlugins(bundlepath=None):
Initialise Scripting/Plugin python environment and load plugins.
Arguments:
scriptpath -- The path to the bundled scripts.
bundlepath -- The path to the bundled scripts.
The bunbled Plugins are relative to this path, in the
"plugins" subdirectory.
WARNING: bundlepath must use '/' as path separator, and not '\'
because it creates issues (\n and \r are seen as escaped seq)
NOTE: These are all of the possible "default" search paths for kicad
python scripts. These paths will ONLY be added to the python