Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
K
kicad-source-mirror
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
Elphel
kicad-source-mirror
Commits
d3f28fb7
Commit
d3f28fb7
authored
Apr 21, 2013
by
Wayne Stambaugh
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix KiCad crash when no template is selected on new project from template. (fixes lp:1170973)
parent
74c64958
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
10 deletions
+17
-10
prjconfig.cpp
kicad/prjconfig.cpp
+17
-10
No files found.
kicad/prjconfig.cpp
View file @
d3f28fb7
...
...
@@ -56,7 +56,8 @@ static const wxString GeneralGroupName( wxT( "/general" ) );
PARAM_CFG_ARRAY
s_KicadManagerParams
;
void
KICAD_MANAGER_FRAME
::
CreateNewProject
(
const
wxString
aPrjFullFileName
,
bool
aTemplateSelector
=
false
)
void
KICAD_MANAGER_FRAME
::
CreateNewProject
(
const
wxString
aPrjFullFileName
,
bool
aTemplateSelector
=
false
)
{
wxString
filename
;
wxFileName
newProjectName
=
aPrjFullFileName
;
...
...
@@ -118,12 +119,16 @@ void KICAD_MANAGER_FRAME::CreateNewProject( const wxString aPrjFullFileName, boo
// Show the project template selector dialog
int
result
=
ps
->
ShowModal
();
if
(
result
!=
wxID_OK
)
if
(
(
result
!=
wxID_OK
)
||
(
ps
->
GetWidget
()
==
NULL
)
)
{
wxMessageBox
(
_
(
"Did not generate new project from template"
),
_
(
"Cancelled new project from template"
),
wxOK
|
wxICON_EXCLAMATION
,
this
);
if
(
ps
->
GetWidget
()
==
NULL
)
{
wxMessageBox
(
_
(
"No project template was selected. Cannot generate new "
"project."
),
_
(
"Error"
),
wxOK
|
wxICON_ERROR
,
this
);
}
}
else
{
...
...
@@ -132,7 +137,7 @@ void KICAD_MANAGER_FRAME::CreateNewProject( const wxString aPrjFullFileName, boo
if
(
!
ps
->
GetWidget
()
->
GetTemplate
()
->
CreateProject
(
newProjectName
)
)
{
wxMessageBox
(
_
(
"Problem whilst creating new project from template!"
),
_
(
"
Could not generate new project
"
),
_
(
"
Template Error
"
),
wxOK
|
wxICON_ERROR
,
this
);
}
...
...
@@ -205,17 +210,19 @@ void KICAD_MANAGER_FRAME::OnLoadProject( wxCommandEvent& event )
// Check if the project directory is empty
wxDir
directory
(
m_ProjectFileName
.
GetPath
()
);
if
(
directory
.
HasFiles
()
)
{
wxString
msg
=
_
(
"The selected directory is not empty. "
"We recommend you create projects in their own clean directory.
\n\n
"
"Do you
want to create a new empty directory for the project?"
);
wxString
msg
=
_
(
"The selected directory is not empty.
We recommend you
"
"create projects in their own clean directory.
\n\n
Do you
"
"
want to create a new empty directory for the project?"
);
if
(
IsOK
(
this
,
msg
)
)
{
// Append a new directory with the same name of the project file
// and try to create it
m_ProjectFileName
.
AppendDir
(
m_ProjectFileName
.
GetName
()
);
if
(
!
wxMkdir
(
m_ProjectFileName
.
GetPath
()
)
)
// There was a problem, undo
m_ProjectFileName
.
RemoveLastDir
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment