Skip to content

Commit

Permalink
Fix the bug with allowing remove any files (issue #6).
Browse files Browse the repository at this point in the history
Now only snippets those placed under default snippets dir allowed for deletion.
  • Loading branch information
grafov committed Dec 16, 2016
1 parent 6e29c4d commit 80ef677
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions go-playground.el
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,11 @@ func main() {
"Remove files of the current snippet together with directory of this snippet."
(interactive)
(save-buffer)
(delete-directory (file-name-directory (buffer-file-name)) t t)
(kill-buffer))
(if (string-match-p (file-truename go-playground-basedir) (file-truename (buffer-file-name)))
(progn (delete-directory (file-name-directory (buffer-file-name)) t t)
(kill-buffer))
(message "Won't delete this! Because %s is not under the path %s. Remove the snippet manually!"
(buffer-file-name) go-playground-basedir)))

;;;###autoload
(defun go-playground-remove-current-snippet ()
Expand Down

0 comments on commit 80ef677

Please sign in to comment.