[Projects] Fix predicates to check for existing projects

This commit is contained in:
Daniel - 2018-08-18 10:49:59 +02:00
parent 2bae031158
commit 1f08b83cf8
Signed by: dbo
GPG Key ID: 4F63DB96D45AA9C6
1 changed files with 8 additions and 5 deletions

View File

@ -23,14 +23,17 @@
(defun projects-project-exists-p (short-name)
"Check whether a project named SHORT-NAME already exists"
(file-exists-p (expand-file-name (concat (file-name-as-directory short-name) ".projectile")
projects-main-project-directory)))
(or
(file-exists-p (expand-file-name (concat (file-name-as-directory short-name)
".git")
projects-main-project-directory))
(file-exists-p (expand-file-name (concat (file-name-as-directory short-name)
".projectile")
projects-main-project-directory))))
(defun projects-existing-projects ()
"Return list of all short-names of existing projects"
(cl-remove-if-not (lambda (name)
(file-exists-p (expand-file-name (concat (file-name-as-directory name) ".projectile")
projects-main-project-directory)))
(cl-remove-if-not #'projects-project-exists-p
(directory-files projects-main-project-directory)))
(defun projects-add-project (short-name long-name)