Closed Hugovdberg closed 6 years ago
I think users should always create a project outside of an existing project. What would be the use case for nested projects?
Technically the custom templates are new projects, so if you happen to be in a project directory when you try to create a new template you get an error. The error is triggered even if the target directory is outside the current directory. A completely valid call to create.template
will therefore fail if called from the wrong working directory.
A completely valid call to create.template will therefore fail if called from the wrong working directory. A completely valid call to create.template will therefore fail if called from the wrong working directory.
I have faced this a few times. Today, have to go through the manual task of changing working dir first creating a new project someplace else, and then changing working dir back again.
So should this be fixed only form create.template
? Or fixing it for create.template
also fixes it for create.project
?
I just realised we could probably alter .stopifproject
to take a path as an argument, so that it can actually check the parent of the target directory instead of the current. That would fix both create.project
and create.template
.
When I was working on #234 , I found that create.project()
has two calls to .stopifproject
which seem redundant.
The 1st call works fine and stops correctly. If the 1st call is commented out, the 2nd call does not work correctly and creates a project within a project.
Just an FYI, we should probably look into this.
Closing this now since the issue is moved to #240
I noticed an error with
create.project
when creating a project specified by a full path, when the working directory is set to a ProjectTemplate project directory. Even though a full path to the new template is specified the.stopifproject
error is triggered.How to reproduce:
create.project
create.project
again (for examplecreate.project(tempdir())
)Possible solution:
.stopifproject
calls in a conditionalif (dirname(project.name)=='.'){}
Is this something we want to implement or should we just expect users to always create a project (and subsequently templates in the current implementation) from outside an existing project? (KISS vs. convenience)