Skip to content

Commit 0621734

Browse files
authored
Add error handling to run_dart_tool.bat (#287)
The error message from Windows when trying to run an executable that doesn't exist isn't very helpful, so explicitly check that the Flutter directory is actually there before trying to run flutter.
1 parent ea662e3 commit 0621734

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

tools/run_dart_tool.bat

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,15 @@ for /f "delims=" %%i in ('%~dp0flutter_location') do set FLUTTER_DIR=%%i
1717
set FLUTTER_BIN_DIR=%FLUTTER_DIR%\bin
1818
set DART_BIN_DIR=%FLUTTER_BIN_DIR%\cache\dart-sdk\bin
1919

20+
if not exist %FLUTTER_DIR%\ (
21+
echo No Flutter directory at %FLUTTER_DIR%.
22+
echo Please see the setup instructions in the README.
23+
exit /b
24+
)
25+
2026
:: Ensure that the Dart SDK has been downloaded.
2127
if not exist %DART_BIN_DIR%\ call %FLUTTER_BIN_DIR%\flutter precache
28+
if %errorlevel% neq 0 exit /b %errorlevel%
2229

2330
set DART_TOOL=%1
2431
for /f "tokens=1,*" %%a in ("%*") do set TOOL_PARAMS=%%b

0 commit comments

Comments
 (0)