From af8969ab385f371216f85e0f3d55d12f185cc50f Mon Sep 17 00:00:00 2001 From: ShootingStarDragons Date: Sat, 25 May 2024 17:52:54 +0800 Subject: [PATCH] feat: can directly specify the path of sdk --- lua/flutter-tools/executable.lua | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/lua/flutter-tools/executable.lua b/lua/flutter-tools/executable.lua index 0a79c3e..e419c01 100644 --- a/lua/flutter-tools/executable.lua +++ b/lua/flutter-tools/executable.lua @@ -126,9 +126,16 @@ function M.get(callback) end end + local flutter_sdk_path = nil + if config.flutter_sdk then flutter_sdk_path = flutter_sdk_path end + if config.flutter_path then - local flutter_path = fn.resolve(config.flutter_path) - _paths = { flutter_bin = flutter_path, flutter_sdk = _flutter_sdk_root(flutter_path) } + local flutter_path = config.flutter_path + local flutter_path_real_try = fn.resolve(flutter_path) + _paths = { + flutter_bin = flutter_path, + flutter_sdk = flutter_path or _flutter_sdk_root(flutter_path_real_try), + } _paths.dart_sdk = _dart_sdk_root(_paths) _paths.dart_bin = _flutter_sdk_dart_bin(_paths.flutter_sdk) return callback(_paths)