Skip to content

Commit d840c70

Browse files
author
webdevred
committed
check the project files exists when using auto
1 parent 2ada981 commit d840c70

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

haskell-customize.el

+6-6
Original file line numberDiff line numberDiff line change
@@ -420,21 +420,21 @@ presence of a *.cabal file or stack.yaml file or something similar.")
420420
(let ((cabal-project (locate-dominating-file default-directory "cabal.project"))
421421
(cabal-sandbox (locate-dominating-file default-directory "cabal.sandbox.config"))
422422
(stack (locate-dominating-file default-directory "stack.yaml"))
423-
(cabal (locate-dominating-file
423+
(cabal (locate-file
424424
default-directory
425425
(lambda (d)
426426
(cl-find-if
427427
(lambda (f) (string-match-p ".\\.cabal\\'" f))
428428
(directory-files d))))))
429429
(cond
430-
((and cabal-project (executable-find "cabal"))
430+
((and (file-exists-p (concat cabal-project "cabal.project")) (executable-find "cabal"))
431431
(cons 'cabal-project cabal-project))
432-
((and cabal-sandbox (executable-find "cabal"))
432+
((and (file-exists-p (concat cabal-sandbox "cabal.sandbox.config")) (executable-find "cabal"))
433433
(cons 'cabal-sandbox cabal-sandbox))
434-
((and stack (executable-find "stack"))
434+
((and (file-exists-p (concat stack "stack.yaml")) (executable-find "stack"))
435435
(cons 'stack stack))
436-
((and cabal (executable-find "cabal"))
437-
(cons 'cabal cabal))
436+
((and cabal (file-exists-p cabal) (executable-find "cabal"))
437+
(cons 'cabal (file-name-directory cabal)))
438438
((executable-find "ghc") (cons 'ghc nil))
439439
(t (error "Could not find any installation of GHC.")))))
440440

0 commit comments

Comments
 (0)