Skip to content

Commit

Permalink
fix: never overwrite presentation files with init command (fixes #35)
Browse files Browse the repository at this point in the history
  • Loading branch information
sinedied committed Mar 15, 2022
1 parent 1c33982 commit 3a9d558
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion backslide.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,10 +105,14 @@ class BackslideCli {
* @param {boolean} force Overwrite existing files.
*/
init(fromTemplateDir, force) {
if (!force && fs.existsSync(path.join(TemplateDir))) {
if (!force && fs.existsSync(TemplateDir)) {
this._exit(`Template directory already exists`);
}

if (!force && fs.existsSync('./presentation.md')) {
this._exit(`Presentation.md already exists`);
}

fromTemplateDir = fromTemplateDir
? path.resolve(fromTemplateDir)
: path.join(__dirname, StarterDir, TemplateDir);
Expand Down

0 comments on commit 3a9d558

Please sign in to comment.