Fix bug in Eeschema component rescue library. (fixes lp:1485352)
* Rescue creates invalid file for project names with spaces. This fix replaces the spaces with underscores to resolve the issue.
This commit is contained in:
parent
b384c94e46
commit
56084b3ee2
|
@ -33,6 +33,7 @@
|
||||||
#include <schframe.h>
|
#include <schframe.h>
|
||||||
#include <wildcards_and_files_ext.h>
|
#include <wildcards_and_files_ext.h>
|
||||||
|
|
||||||
|
#include <cctype>
|
||||||
#include <boost/foreach.hpp>
|
#include <boost/foreach.hpp>
|
||||||
#include <map>
|
#include <map>
|
||||||
|
|
||||||
|
@ -331,7 +332,7 @@ public:
|
||||||
typedef std::map<wxString, RESCUE_CACHE_CANDIDATE> candidate_map_t;
|
typedef std::map<wxString, RESCUE_CACHE_CANDIDATE> candidate_map_t;
|
||||||
candidate_map_t candidate_map;
|
candidate_map_t candidate_map;
|
||||||
|
|
||||||
wxString part_name_suffix = wxT( "-RESCUE-" ) + aRescuer.GetPrj()->GetProjectName();
|
wxString part_name_suffix = aRescuer.GetPartNameSuffix();
|
||||||
|
|
||||||
BOOST_FOREACH( SCH_COMPONENT* each_component, *( aRescuer.GetComponents() ) )
|
BOOST_FOREACH( SCH_COMPONENT* each_component, *( aRescuer.GetComponents() ) )
|
||||||
{
|
{
|
||||||
|
@ -497,6 +498,22 @@ void RESCUER::UndoRescues()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
wxString RESCUER::GetPartNameSuffix()
|
||||||
|
{
|
||||||
|
wxString suffix = wxT( "-RESCUE-" );
|
||||||
|
wxString pname = GetPrj()->GetProjectName();
|
||||||
|
for( size_t i = 0; i < pname.Len(); ++i )
|
||||||
|
{
|
||||||
|
if( isspace( pname[i].GetValue() ) )
|
||||||
|
suffix.Append( '_' );
|
||||||
|
else
|
||||||
|
suffix.Append( pname[i] );
|
||||||
|
}
|
||||||
|
|
||||||
|
return suffix;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
bool SCH_EDIT_FRAME::RescueProject( bool aRunningOnDemand )
|
bool SCH_EDIT_FRAME::RescueProject( bool aRunningOnDemand )
|
||||||
{
|
{
|
||||||
RESCUER rescuer( *this, Prj() );
|
RESCUER rescuer( *this, Prj() );
|
||||||
|
|
|
@ -161,6 +161,12 @@ public:
|
||||||
*/
|
*/
|
||||||
PROJECT* GetPrj() { return m_prj; }
|
PROJECT* GetPrj() { return m_prj; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function GetPartNameSuffix
|
||||||
|
* Return the suffix to add to rescued parts.
|
||||||
|
*/
|
||||||
|
wxString GetPartNameSuffix();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function InvokeDialog
|
* Function InvokeDialog
|
||||||
* Display a dialog to allow the user to select rescues.
|
* Display a dialog to allow the user to select rescues.
|
||||||
|
|
Loading…
Reference in New Issue