Skip to content

Commit 80ef677

Browse files
committed
Fix the bug with allowing remove any files (issue #6).
Now only snippets those placed under default snippets dir allowed for deletion.
1 parent 6e29c4d commit 80ef677

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

go-playground.el

+5-2
Original file line numberDiff line numberDiff line change
@@ -134,8 +134,11 @@ func main() {
134134
"Remove files of the current snippet together with directory of this snippet."
135135
(interactive)
136136
(save-buffer)
137-
(delete-directory (file-name-directory (buffer-file-name)) t t)
138-
(kill-buffer))
137+
(if (string-match-p (file-truename go-playground-basedir) (file-truename (buffer-file-name)))
138+
(progn (delete-directory (file-name-directory (buffer-file-name)) t t)
139+
(kill-buffer))
140+
(message "Won't delete this! Because %s is not under the path %s. Remove the snippet manually!"
141+
(buffer-file-name) go-playground-basedir)))
139142

140143
;;;###autoload
141144
(defun go-playground-remove-current-snippet ()

0 commit comments

Comments
 (0)