← Back to team overview

kicad-developers team mailing list archive

Project template behavior.

 

Currently there are three locations where the create project from
template dialog looks for project template folders:

1) A sketchy attempt to find the system install path based on the
current executable path on windows and linux and a completely different
path for macos.  Templates found in this path are added to the "System"
tab in the templates dialog.  This is broken on macos.

2) The value of the KICAD_PTEMPLATES environment variable which defaults
to the ${DEFAULT_INSTALL_PATH} defined at the build configuration or
${CMAKE_INSTALL_PATH} by default.  Templates found in this path are
added to the "Portable" templates tab in the templates dialog.  On
windows and linux this ends up being the same path as #1.

3) A hard coded user path derived frm the return value of
wxStandardPaths::GetDocumentsDir() with kicad/template appended.
Templates found in this path are added to the "User" templates folder in
the template dialog.  This is documented in the Eeschema users manual
but the path is not correct for current windows versions.

In order to make this less confusing and more flexible for the user, I
propose that we:

1) Use the default search stack mechanism for finding the templates
installed with kicad.  It is far more likely to be correct.

2) Override the default system path in #1 with KICAD_TEMPLATE_DIR when
available using our normal environment variable handling.

3) Do not support the KICAD_PTEMPLATES environment variable since it's
purposed is vague at best.

4) Create a new internal environment variable KICAD_USER_TEMPLATE_DIR
that defaults to the original hard coded paths above that can be changed
by the user if they so choose.

I would like to do this for v5 to support multiple kicad installs.
There is one piece of the puzzle missing and that is support for
changing the default project file path.  Currently the default project
file path is the system template path.  We need to able to point to a
different template path because the default project file for v5 cannot
have and symbol libraries defined and for v4 they need to be defined.

One other minor annoyance I would like to fix is to prompt the user for
the project folder after the template is selected when creating a new
project from a template.

If anyone can think of a reason why these changes should not be made,
please let me know?

Cheers,

Wayne