Skip to content

Commit bb974bc

Browse files
committed
Check if flutter and dart command exists before use them
1 parent a06fc74 commit bb974bc

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

lsp-dart-utils.el

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,11 +102,17 @@ FLUTTER_ROOT environment variable."
102102

103103
(defun lsp-dart-dart-command ()
104104
"Return the dart executable from Dart SDK dir."
105-
(expand-file-name "bin/dart" (lsp-dart-get-sdk-dir)))
105+
(let ((command (expand-file-name "bin/dart" (lsp-dart-get-sdk-dir))))
106+
(if (file-exists-p command)
107+
command
108+
(lsp-dart-log "Dart command not found in path '%s'" command))))
106109

107110
(defun lsp-dart-flutter-command ()
108111
"Return the flutter executable from Flutter SDK dir."
109-
(expand-file-name "bin/flutter" (lsp-dart-get-flutter-sdk-dir)))
112+
(let ((command (expand-file-name "bin/flutter" (lsp-dart-get-flutter-sdk-dir))))
113+
(if (file-exists-p command)
114+
command
115+
(lsp-dart-log "Flutter command not found in path '%s'" command))))
110116

111117

112118
;; Project

0 commit comments

Comments
 (0)