Don't infer two projects when we find both .kicad_pro and .pro.
Also makes the terminology around folder/directory consistent in the error messages and dialogs. Fixes https://gitlab.com/kicad/code/kicad/issues/8481
This commit is contained in:
parent
75ce97e260
commit
b00d01dcc4
|
@ -1,5 +1,5 @@
|
||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
// C++ code generated with wxFormBuilder (version v3.8.0)
|
// C++ code generated with wxFormBuilder (version Oct 26 2018)
|
||||||
// http://www.wxformbuilder.org/
|
// http://www.wxformbuilder.org/
|
||||||
//
|
//
|
||||||
// PLEASE DO *NOT* EDIT THIS FILE!
|
// PLEASE DO *NOT* EDIT THIS FILE!
|
||||||
|
@ -21,26 +21,26 @@ DIALOG_TEMPLATE_SELECTOR_BASE::DIALOG_TEMPLATE_SELECTOR_BASE( wxWindow* parent,
|
||||||
bmainSizer->Add( m_notebook, 0, wxEXPAND | wxALL, 3 );
|
bmainSizer->Add( m_notebook, 0, wxEXPAND | wxALL, 3 );
|
||||||
|
|
||||||
m_htmlWin = new wxHtmlWindow( this, wxID_ANY, wxDefaultPosition, wxSize( -1,-1 ), wxHW_SCROLLBAR_AUTO );
|
m_htmlWin = new wxHtmlWindow( this, wxID_ANY, wxDefaultPosition, wxSize( -1,-1 ), wxHW_SCROLLBAR_AUTO );
|
||||||
bmainSizer->Add( m_htmlWin, 1, wxALL|wxEXPAND, 3 );
|
bmainSizer->Add( m_htmlWin, 1, wxALL|wxEXPAND, 10 );
|
||||||
|
|
||||||
m_staticTextTpath = new wxStaticText( this, wxID_ANY, _("Template path:"), wxDefaultPosition, wxDefaultSize, 0 );
|
|
||||||
m_staticTextTpath->Wrap( -1 );
|
|
||||||
bmainSizer->Add( m_staticTextTpath, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
|
|
||||||
|
|
||||||
wxBoxSizer* bsizerTemplateSelector;
|
wxBoxSizer* bsizerTemplateSelector;
|
||||||
bsizerTemplateSelector = new wxBoxSizer( wxHORIZONTAL );
|
bsizerTemplateSelector = new wxBoxSizer( wxHORIZONTAL );
|
||||||
|
|
||||||
|
m_staticTextTpath = new wxStaticText( this, wxID_ANY, _("Folder:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||||
|
m_staticTextTpath->Wrap( -1 );
|
||||||
|
bsizerTemplateSelector->Add( m_staticTextTpath, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 );
|
||||||
|
|
||||||
m_tcTemplatePath = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_PROCESS_ENTER );
|
m_tcTemplatePath = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_PROCESS_ENTER );
|
||||||
bsizerTemplateSelector->Add( m_tcTemplatePath, 1, wxBOTTOM|wxLEFT|wxRIGHT, 5 );
|
bsizerTemplateSelector->Add( m_tcTemplatePath, 1, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 );
|
||||||
|
|
||||||
m_buttonBrowse = new wxButton( this, wxID_ANY, _("Browse"), wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT );
|
m_buttonBrowse = new wxButton( this, wxID_ANY, _("Browse"), wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT );
|
||||||
bsizerTemplateSelector->Add( m_buttonBrowse, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT, 5 );
|
bsizerTemplateSelector->Add( m_buttonBrowse, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 );
|
||||||
|
|
||||||
m_buttonValidate = new wxButton( this, wxID_ANY, _("Validate"), wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT );
|
m_buttonValidate = new wxButton( this, wxID_ANY, _("Validate"), wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT );
|
||||||
bsizerTemplateSelector->Add( m_buttonValidate, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT, 5 );
|
bsizerTemplateSelector->Add( m_buttonValidate, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 );
|
||||||
|
|
||||||
|
|
||||||
bmainSizer->Add( bsizerTemplateSelector, 0, wxEXPAND, 5 );
|
bmainSizer->Add( bsizerTemplateSelector, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
|
||||||
|
|
||||||
m_staticline = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
|
m_staticline = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
|
||||||
bmainSizer->Add( m_staticline, 0, wxEXPAND | wxALL, 5 );
|
bmainSizer->Add( m_staticline, 0, wxEXPAND | wxALL, 5 );
|
||||||
|
|
|
@ -119,7 +119,7 @@
|
||||||
</object>
|
</object>
|
||||||
</object>
|
</object>
|
||||||
<object class="sizeritem" expanded="1">
|
<object class="sizeritem" expanded="1">
|
||||||
<property name="border">3</property>
|
<property name="border">10</property>
|
||||||
<property name="flag">wxALL|wxEXPAND</property>
|
<property name="flag">wxALL|wxEXPAND</property>
|
||||||
<property name="proportion">1</property>
|
<property name="proportion">1</property>
|
||||||
<object class="wxHtmlWindow" expanded="1">
|
<object class="wxHtmlWindow" expanded="1">
|
||||||
|
@ -179,68 +179,7 @@
|
||||||
</object>
|
</object>
|
||||||
<object class="sizeritem" expanded="1">
|
<object class="sizeritem" expanded="1">
|
||||||
<property name="border">5</property>
|
<property name="border">5</property>
|
||||||
<property name="flag">wxTOP|wxRIGHT|wxLEFT</property>
|
<property name="flag">wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT</property>
|
||||||
<property name="proportion">0</property>
|
|
||||||
<object class="wxStaticText" expanded="1">
|
|
||||||
<property name="BottomDockable">1</property>
|
|
||||||
<property name="LeftDockable">1</property>
|
|
||||||
<property name="RightDockable">1</property>
|
|
||||||
<property name="TopDockable">1</property>
|
|
||||||
<property name="aui_layer"></property>
|
|
||||||
<property name="aui_name"></property>
|
|
||||||
<property name="aui_position"></property>
|
|
||||||
<property name="aui_row"></property>
|
|
||||||
<property name="best_size"></property>
|
|
||||||
<property name="bg"></property>
|
|
||||||
<property name="caption"></property>
|
|
||||||
<property name="caption_visible">1</property>
|
|
||||||
<property name="center_pane">0</property>
|
|
||||||
<property name="close_button">1</property>
|
|
||||||
<property name="context_help"></property>
|
|
||||||
<property name="context_menu">1</property>
|
|
||||||
<property name="default_pane">0</property>
|
|
||||||
<property name="dock">Dock</property>
|
|
||||||
<property name="dock_fixed">0</property>
|
|
||||||
<property name="docking">Left</property>
|
|
||||||
<property name="enabled">1</property>
|
|
||||||
<property name="fg"></property>
|
|
||||||
<property name="floatable">1</property>
|
|
||||||
<property name="font"></property>
|
|
||||||
<property name="gripper">0</property>
|
|
||||||
<property name="hidden">0</property>
|
|
||||||
<property name="id">wxID_ANY</property>
|
|
||||||
<property name="label">Template path:</property>
|
|
||||||
<property name="markup">0</property>
|
|
||||||
<property name="max_size"></property>
|
|
||||||
<property name="maximize_button">0</property>
|
|
||||||
<property name="maximum_size"></property>
|
|
||||||
<property name="min_size"></property>
|
|
||||||
<property name="minimize_button">0</property>
|
|
||||||
<property name="minimum_size"></property>
|
|
||||||
<property name="moveable">1</property>
|
|
||||||
<property name="name">m_staticTextTpath</property>
|
|
||||||
<property name="pane_border">1</property>
|
|
||||||
<property name="pane_position"></property>
|
|
||||||
<property name="pane_size"></property>
|
|
||||||
<property name="permission">protected</property>
|
|
||||||
<property name="pin_button">1</property>
|
|
||||||
<property name="pos"></property>
|
|
||||||
<property name="resize">Resizable</property>
|
|
||||||
<property name="show">1</property>
|
|
||||||
<property name="size"></property>
|
|
||||||
<property name="style"></property>
|
|
||||||
<property name="subclass"></property>
|
|
||||||
<property name="toolbar_pane">0</property>
|
|
||||||
<property name="tooltip"></property>
|
|
||||||
<property name="window_extra_style"></property>
|
|
||||||
<property name="window_name"></property>
|
|
||||||
<property name="window_style"></property>
|
|
||||||
<property name="wrap">-1</property>
|
|
||||||
</object>
|
|
||||||
</object>
|
|
||||||
<object class="sizeritem" expanded="1">
|
|
||||||
<property name="border">5</property>
|
|
||||||
<property name="flag">wxEXPAND</property>
|
|
||||||
<property name="proportion">0</property>
|
<property name="proportion">0</property>
|
||||||
<object class="wxBoxSizer" expanded="1">
|
<object class="wxBoxSizer" expanded="1">
|
||||||
<property name="minimum_size"></property>
|
<property name="minimum_size"></property>
|
||||||
|
@ -249,7 +188,68 @@
|
||||||
<property name="permission">none</property>
|
<property name="permission">none</property>
|
||||||
<object class="sizeritem" expanded="1">
|
<object class="sizeritem" expanded="1">
|
||||||
<property name="border">5</property>
|
<property name="border">5</property>
|
||||||
<property name="flag">wxBOTTOM|wxLEFT|wxRIGHT</property>
|
<property name="flag">wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT</property>
|
||||||
|
<property name="proportion">0</property>
|
||||||
|
<object class="wxStaticText" expanded="1">
|
||||||
|
<property name="BottomDockable">1</property>
|
||||||
|
<property name="LeftDockable">1</property>
|
||||||
|
<property name="RightDockable">1</property>
|
||||||
|
<property name="TopDockable">1</property>
|
||||||
|
<property name="aui_layer"></property>
|
||||||
|
<property name="aui_name"></property>
|
||||||
|
<property name="aui_position"></property>
|
||||||
|
<property name="aui_row"></property>
|
||||||
|
<property name="best_size"></property>
|
||||||
|
<property name="bg"></property>
|
||||||
|
<property name="caption"></property>
|
||||||
|
<property name="caption_visible">1</property>
|
||||||
|
<property name="center_pane">0</property>
|
||||||
|
<property name="close_button">1</property>
|
||||||
|
<property name="context_help"></property>
|
||||||
|
<property name="context_menu">1</property>
|
||||||
|
<property name="default_pane">0</property>
|
||||||
|
<property name="dock">Dock</property>
|
||||||
|
<property name="dock_fixed">0</property>
|
||||||
|
<property name="docking">Left</property>
|
||||||
|
<property name="enabled">1</property>
|
||||||
|
<property name="fg"></property>
|
||||||
|
<property name="floatable">1</property>
|
||||||
|
<property name="font"></property>
|
||||||
|
<property name="gripper">0</property>
|
||||||
|
<property name="hidden">0</property>
|
||||||
|
<property name="id">wxID_ANY</property>
|
||||||
|
<property name="label">Folder:</property>
|
||||||
|
<property name="markup">0</property>
|
||||||
|
<property name="max_size"></property>
|
||||||
|
<property name="maximize_button">0</property>
|
||||||
|
<property name="maximum_size"></property>
|
||||||
|
<property name="min_size"></property>
|
||||||
|
<property name="minimize_button">0</property>
|
||||||
|
<property name="minimum_size"></property>
|
||||||
|
<property name="moveable">1</property>
|
||||||
|
<property name="name">m_staticTextTpath</property>
|
||||||
|
<property name="pane_border">1</property>
|
||||||
|
<property name="pane_position"></property>
|
||||||
|
<property name="pane_size"></property>
|
||||||
|
<property name="permission">protected</property>
|
||||||
|
<property name="pin_button">1</property>
|
||||||
|
<property name="pos"></property>
|
||||||
|
<property name="resize">Resizable</property>
|
||||||
|
<property name="show">1</property>
|
||||||
|
<property name="size"></property>
|
||||||
|
<property name="style"></property>
|
||||||
|
<property name="subclass"></property>
|
||||||
|
<property name="toolbar_pane">0</property>
|
||||||
|
<property name="tooltip"></property>
|
||||||
|
<property name="window_extra_style"></property>
|
||||||
|
<property name="window_name"></property>
|
||||||
|
<property name="window_style"></property>
|
||||||
|
<property name="wrap">-1</property>
|
||||||
|
</object>
|
||||||
|
</object>
|
||||||
|
<object class="sizeritem" expanded="1">
|
||||||
|
<property name="border">5</property>
|
||||||
|
<property name="flag">wxALIGN_CENTER_VERTICAL|wxRIGHT</property>
|
||||||
<property name="proportion">1</property>
|
<property name="proportion">1</property>
|
||||||
<object class="wxTextCtrl" expanded="1">
|
<object class="wxTextCtrl" expanded="1">
|
||||||
<property name="BottomDockable">1</property>
|
<property name="BottomDockable">1</property>
|
||||||
|
@ -313,7 +313,7 @@
|
||||||
</object>
|
</object>
|
||||||
<object class="sizeritem" expanded="1">
|
<object class="sizeritem" expanded="1">
|
||||||
<property name="border">5</property>
|
<property name="border">5</property>
|
||||||
<property name="flag">wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT</property>
|
<property name="flag">wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT</property>
|
||||||
<property name="proportion">0</property>
|
<property name="proportion">0</property>
|
||||||
<object class="wxButton" expanded="1">
|
<object class="wxButton" expanded="1">
|
||||||
<property name="BottomDockable">1</property>
|
<property name="BottomDockable">1</property>
|
||||||
|
@ -386,7 +386,7 @@
|
||||||
</object>
|
</object>
|
||||||
<object class="sizeritem" expanded="1">
|
<object class="sizeritem" expanded="1">
|
||||||
<property name="border">5</property>
|
<property name="border">5</property>
|
||||||
<property name="flag">wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT</property>
|
<property name="flag">wxALIGN_CENTER_VERTICAL|wxRIGHT</property>
|
||||||
<property name="proportion">0</property>
|
<property name="proportion">0</property>
|
||||||
<object class="wxButton" expanded="1">
|
<object class="wxButton" expanded="1">
|
||||||
<property name="BottomDockable">1</property>
|
<property name="BottomDockable">1</property>
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
// C++ code generated with wxFormBuilder (version v3.8.0)
|
// C++ code generated with wxFormBuilder (version Oct 26 2018)
|
||||||
// http://www.wxformbuilder.org/
|
// http://www.wxformbuilder.org/
|
||||||
//
|
//
|
||||||
// PLEASE DO *NOT* EDIT THIS FILE!
|
// PLEASE DO *NOT* EDIT THIS FILE!
|
||||||
|
|
|
@ -125,18 +125,20 @@ size_t PROJECT_TEMPLATE::GetDestinationFiles( const wxFileName& aNewProjectPath,
|
||||||
|
|
||||||
// Find the template file name base. this is the name of the .pro template file
|
// Find the template file name base. this is the name of the .pro template file
|
||||||
wxString basename;
|
wxString basename;
|
||||||
int projectCount = 0;
|
bool multipleProjectFilesFound = false;
|
||||||
|
|
||||||
for( wxFileName& file : srcFiles )
|
for( wxFileName& file : srcFiles )
|
||||||
{
|
{
|
||||||
if( file.GetExt() == ProjectFileExtension || file.GetExt() == LegacyProjectFileExtension )
|
if( file.GetExt() == ProjectFileExtension || file.GetExt() == LegacyProjectFileExtension )
|
||||||
{
|
{
|
||||||
|
if( !basename.IsEmpty() && basename != file.GetName() )
|
||||||
|
multipleProjectFilesFound = true;
|
||||||
|
|
||||||
basename = file.GetName();
|
basename = file.GetName();
|
||||||
projectCount++;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if( projectCount != 1 )
|
if( multipleProjectFilesFound )
|
||||||
basename = GetPrjDirName();
|
basename = GetPrjDirName();
|
||||||
|
|
||||||
for( wxFileName& srcFile : srcFiles )
|
for( wxFileName& srcFile : srcFiles )
|
||||||
|
@ -163,26 +165,29 @@ size_t PROJECT_TEMPLATE::GetDestinationFiles( const wxFileName& aNewProjectPath,
|
||||||
|
|
||||||
bool PROJECT_TEMPLATE::CreateProject( wxFileName& aNewProjectPath, wxString* aErrorMsg )
|
bool PROJECT_TEMPLATE::CreateProject( wxFileName& aNewProjectPath, wxString* aErrorMsg )
|
||||||
{
|
{
|
||||||
// CreateProject copy the files from template to the new project folder
|
// CreateProject copy the files from template to the new project folder and renames files
|
||||||
// and rename files which have the same name as the template .pro file
|
// which have the same name as the template .kicad_pro file
|
||||||
bool result = true;
|
bool result = true;
|
||||||
|
|
||||||
std::vector<wxFileName> srcFiles = GetFileList();
|
std::vector<wxFileName> srcFiles = GetFileList();
|
||||||
|
|
||||||
// Find the template file name base. this is the name of the .pro template file
|
// Find the template file name base. this is the name of the .kicad_pro (or .pro) template
|
||||||
|
// file
|
||||||
wxString basename;
|
wxString basename;
|
||||||
int projectCount = 0;
|
bool multipleProjectFilesFound = false;
|
||||||
|
|
||||||
for( wxFileName& file : srcFiles )
|
for( wxFileName& file : srcFiles )
|
||||||
{
|
{
|
||||||
if( file.GetExt() == ProjectFileExtension || file.GetExt() == LegacyProjectFileExtension )
|
if( file.GetExt() == ProjectFileExtension || file.GetExt() == LegacyProjectFileExtension )
|
||||||
{
|
{
|
||||||
|
if( !basename.IsEmpty() && basename != file.GetName() )
|
||||||
|
multipleProjectFilesFound = true;
|
||||||
|
|
||||||
basename = file.GetName();
|
basename = file.GetName();
|
||||||
projectCount++;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if( projectCount != 1 )
|
if( multipleProjectFilesFound )
|
||||||
basename = GetPrjDirName();
|
basename = GetPrjDirName();
|
||||||
|
|
||||||
for( wxFileName& srcFile : srcFiles )
|
for( wxFileName& srcFile : srcFiles )
|
||||||
|
@ -193,10 +198,20 @@ bool PROJECT_TEMPLATE::CreateProject( wxFileName& aNewProjectPath, wxString* aEr
|
||||||
// Replace the template filename with the project filename for the new project creation
|
// Replace the template filename with the project filename for the new project creation
|
||||||
wxString currname = destFile.GetName();
|
wxString currname = destFile.GetName();
|
||||||
|
|
||||||
// Do not rename project specific symbol libraries. This will break the symbol library
|
if( destFile.GetExt() == DrawingSheetFileExtension )
|
||||||
// table which will cause broken symbol library links in the schematic.
|
{
|
||||||
if( !( destFile.GetExt() == DrawingSheetFileExtension ) && !( destFile.GetExt() == "dcm"
|
// Skip these; they're often shared
|
||||||
|| ( destFile.GetExt() == "lib" && !destFile.GetName().EndsWith( "-cache" ) ) ) )
|
}
|
||||||
|
if( destFile.GetName().EndsWith( "-cache" ) || destFile.GetName().EndsWith( "-rescue" ) )
|
||||||
|
{
|
||||||
|
currname.Replace( basename, aNewProjectPath.GetName() );
|
||||||
|
}
|
||||||
|
else if( destFile.GetExt() == "dcm" || destFile.GetExt() == "lib" )
|
||||||
|
{
|
||||||
|
// Don't rename project-specific symbol libraries. This will break the symbol library
|
||||||
|
// table which will cause broken symbol library links in the schematic.
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
currname.Replace( basename, aNewProjectPath.GetName() );
|
currname.Replace( basename, aNewProjectPath.GetName() );
|
||||||
}
|
}
|
||||||
|
@ -208,8 +223,7 @@ bool PROJECT_TEMPLATE::CreateProject( wxFileName& aNewProjectPath, wxString* aEr
|
||||||
wxString destpath = destFile.GetPathWithSep();
|
wxString destpath = destFile.GetPathWithSep();
|
||||||
destpath.Replace( m_basePath.GetPathWithSep(), aNewProjectPath.GetPathWithSep() );
|
destpath.Replace( m_basePath.GetPathWithSep(), aNewProjectPath.GetPathWithSep() );
|
||||||
|
|
||||||
// Check to see if the path already exists, if not attempt to create it here. Don't worry
|
// Check to see if the path already exists, if not attempt to create it here.
|
||||||
// about error checking, if the path isn't created the file copy will fail anyway
|
|
||||||
if( !wxFileName::DirExists( destpath ) )
|
if( !wxFileName::DirExists( destpath ) )
|
||||||
{
|
{
|
||||||
if( !wxFileName::Mkdir( destpath, 0777, wxPATH_MKDIR_FULL ) )
|
if( !wxFileName::Mkdir( destpath, 0777, wxPATH_MKDIR_FULL ) )
|
||||||
|
@ -221,7 +235,7 @@ bool PROJECT_TEMPLATE::CreateProject( wxFileName& aNewProjectPath, wxString* aEr
|
||||||
|
|
||||||
wxString msg;
|
wxString msg;
|
||||||
|
|
||||||
msg.Printf( _( "Cannot create folder \"%s\"." ), destpath );
|
msg.Printf( _( "Cannot create folder '%s'." ), destpath );
|
||||||
*aErrorMsg += msg;
|
*aErrorMsg += msg;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -240,7 +254,7 @@ bool PROJECT_TEMPLATE::CreateProject( wxFileName& aNewProjectPath, wxString* aEr
|
||||||
|
|
||||||
wxString msg;
|
wxString msg;
|
||||||
|
|
||||||
msg.Printf( _( "Cannot copy file \"%s\"." ), destFile.GetFullPath() );
|
msg.Printf( _( "Cannot copy file '%s'." ), destFile.GetFullPath() );
|
||||||
*aErrorMsg += msg;
|
*aErrorMsg += msg;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -42,8 +42,7 @@ public:
|
||||||
DIR_CHECKBOX( wxWindow* aParent )
|
DIR_CHECKBOX( wxWindow* aParent )
|
||||||
: wxPanel( aParent )
|
: wxPanel( aParent )
|
||||||
{
|
{
|
||||||
m_cbCreateDir = new wxCheckBox( this, wxID_ANY,
|
m_cbCreateDir = new wxCheckBox( this, wxID_ANY, _( "Create a new folder for the project" ) );
|
||||||
_( "Create a new directory for the project" ) );
|
|
||||||
m_cbCreateDir->SetValue( true );
|
m_cbCreateDir->SetValue( true );
|
||||||
|
|
||||||
wxBoxSizer* sizer = new wxBoxSizer( wxHORIZONTAL );
|
wxBoxSizer* sizer = new wxBoxSizer( wxHORIZONTAL );
|
||||||
|
@ -116,8 +115,8 @@ int KICAD_MANAGER_CONTROL::NewProject( const TOOL_EVENT& aEvent )
|
||||||
if( !pro.Mkdir() )
|
if( !pro.Mkdir() )
|
||||||
{
|
{
|
||||||
wxString msg;
|
wxString msg;
|
||||||
msg.Printf( _( "Directory \"%s\" could not be created.\n\n"
|
msg.Printf( _( "Folder '%s' could not be created.\n\n"
|
||||||
"Please make sure you have write permissions and try again." ),
|
"Make sure you have write permissions and try again." ),
|
||||||
pro.GetPath() );
|
pro.GetPath() );
|
||||||
DisplayErrorMessage( m_frame, msg );
|
DisplayErrorMessage( m_frame, msg );
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -125,9 +124,9 @@ int KICAD_MANAGER_CONTROL::NewProject( const TOOL_EVENT& aEvent )
|
||||||
}
|
}
|
||||||
else if( directory.HasFiles() )
|
else if( directory.HasFiles() )
|
||||||
{
|
{
|
||||||
wxString msg = _( "The selected directory is not empty. It is recommended that you "
|
wxString msg = _( "The selected folder is not empty. It is recommended that you "
|
||||||
"create projects in their own empty directory.\n\nDo you "
|
"create projects in their own empty folder.\n\n"
|
||||||
"want to continue?" );
|
"Do you want to continue?" );
|
||||||
|
|
||||||
if( !IsOK( m_frame, msg ) )
|
if( !IsOK( m_frame, msg ) )
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -191,8 +190,8 @@ int KICAD_MANAGER_CONTROL::NewFromTemplate( const TOOL_EVENT& aEvent )
|
||||||
|
|
||||||
wxFileName fn( dlg.GetPath() );
|
wxFileName fn( dlg.GetPath() );
|
||||||
|
|
||||||
// wxFileName automatically extracts an extension. But if it isn't
|
// wxFileName automatically extracts an extension. But if it isn't a .kicad_pro extension,
|
||||||
// a .pro extension, we should keep it as part of the filename
|
// we should keep it as part of the filename
|
||||||
if( !fn.GetExt().IsEmpty() && fn.GetExt().ToStdString() != ProjectFileExtension )
|
if( !fn.GetExt().IsEmpty() && fn.GetExt().ToStdString() != ProjectFileExtension )
|
||||||
fn.SetName( fn.GetName() + wxT( "." ) + fn.GetExt() );
|
fn.SetName( fn.GetName() + wxT( "." ) + fn.GetExt() );
|
||||||
|
|
||||||
|
@ -213,8 +212,8 @@ int KICAD_MANAGER_CONTROL::NewFromTemplate( const TOOL_EVENT& aEvent )
|
||||||
if( !fn.Mkdir() )
|
if( !fn.Mkdir() )
|
||||||
{
|
{
|
||||||
wxString msg;
|
wxString msg;
|
||||||
msg.Printf( _( "Directory \"%s\" could not be created.\n\n"
|
msg.Printf( _( "Folder '%s' could not be created.\n\n"
|
||||||
"Please make sure you have write permissions and try again." ),
|
"Make sure you have write permissions and try again." ),
|
||||||
fn.GetPath() );
|
fn.GetPath() );
|
||||||
DisplayErrorMessage( m_frame, msg );
|
DisplayErrorMessage( m_frame, msg );
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -225,10 +224,9 @@ int KICAD_MANAGER_CONTROL::NewFromTemplate( const TOOL_EVENT& aEvent )
|
||||||
{
|
{
|
||||||
wxString msg;
|
wxString msg;
|
||||||
|
|
||||||
msg.Printf( _( "Cannot write to folder \"%s\"." ), fn.GetPath() );
|
msg.Printf( _( "Cannot write to folder '%s'." ), fn.GetPath() );
|
||||||
wxMessageDialog msgDlg( m_frame, msg, _( "Error!" ), wxICON_ERROR | wxOK | wxCENTER );
|
wxMessageDialog msgDlg( m_frame, msg, _( "Error" ), wxICON_ERROR | wxOK | wxCENTER );
|
||||||
msgDlg.SetExtendedMessage( _( "Please check your access permissions to this folder "
|
msgDlg.SetExtendedMessage( _( "Make sure you have write permissions and try again." ) );
|
||||||
"and try again." ) );
|
|
||||||
msgDlg.ShowModal();
|
msgDlg.ShowModal();
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -271,8 +269,8 @@ int KICAD_MANAGER_CONTROL::NewFromTemplate( const TOOL_EVENT& aEvent )
|
||||||
if( !ps->GetSelectedTemplate()->CreateProject( fn, &errorMsg ) )
|
if( !ps->GetSelectedTemplate()->CreateProject( fn, &errorMsg ) )
|
||||||
{
|
{
|
||||||
wxMessageDialog createDlg( m_frame,
|
wxMessageDialog createDlg( m_frame,
|
||||||
_( "A problem occurred creating new project from template!" ),
|
_( "A problem occurred creating new project from template." ),
|
||||||
_( "Template Error" ),
|
_( "Error" ),
|
||||||
wxOK | wxICON_ERROR );
|
wxOK | wxICON_ERROR );
|
||||||
|
|
||||||
if( !errorMsg.empty() )
|
if( !errorMsg.empty() )
|
||||||
|
|
Loading…
Reference in New Issue