Skip to content

Commit a76b4c4

Browse files
committed
Fix Windows support
1 parent 9364f79 commit a76b4c4

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

lsp-dart-utils.el

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,8 @@ FLUTTER_ROOT environment variable."
9696

9797
(defun lsp-dart-pub-command ()
9898
"Return the pub executable path from Dart SDK path."
99+
(if (eq system-type 'windows-nt)
100+
(expand-file-name "bin/pub.bat" (lsp-dart-get-sdk-dir)))
99101
(expand-file-name "bin/pub" (lsp-dart-get-sdk-dir)))
100102

101103
(defun lsp-dart-pub-snapshot-command ()
@@ -104,14 +106,16 @@ FLUTTER_ROOT environment variable."
104106

105107
(defun lsp-dart-dart-command ()
106108
"Return the dart executable from Dart SDK dir."
107-
(let ((command (expand-file-name "bin/dart" (lsp-dart-get-sdk-dir))))
109+
(let* ((executable-path (if (eq system-type 'windows-nt) "bin/dart.exe" "bin/dart"))
110+
(command (expand-file-name executable-path (lsp-dart-get-sdk-dir))))
108111
(if (file-exists-p command)
109112
command
110113
(lsp-dart-log "Dart command not found in path '%s'" command))))
111114

112115
(defun lsp-dart-flutter-command ()
113116
"Return the flutter executable from Flutter SDK dir."
114-
(let ((command (expand-file-name "bin/flutter" (lsp-dart-get-flutter-sdk-dir))))
117+
(let* ((executable-path (if (eq system-type 'windows-nt) "bin/flutter.bat" "bin/flutter"))
118+
(command (expand-file-name executable-path (lsp-dart-get-flutter-sdk-dir))))
115119
(if (file-exists-p command)
116120
command
117121
(lsp-dart-log "Flutter command not found in path '%s'" command))))

0 commit comments

Comments
 (0)