@@ -31,6 +31,8 @@ local current_device = nil
3131--- @type flutter.Runner ?
3232local runner = nil
3333
34+ local fvm_name = path .is_windows and " fvm.bat" or " fvm"
35+
3436local function use_debugger_runner (force_debug )
3537 if force_debug or config .debugger .enabled then
3638 local dap_ok , _ = pcall (require , " dap" )
190192local function get_absolute_path (input_path )
191193 -- Check if the provided path is an absolute path
192194 if
193- vim .fn .isdirectory (input_path ) == 1
194- and not input_path :match (" ^/" )
195- and not input_path :match (" ^%a:[/\\ ]" )
195+ vim .fn .isdirectory (input_path ) == 1
196+ and not input_path :match (" ^/" )
197+ and not input_path :match (" ^%a:[/\\ ]" )
196198 then
197199 -- It's a relative path, so expand it to an absolute path
198200 local absolute_path = vim .fn .fnamemodify (input_path , " :p" )
@@ -235,23 +237,23 @@ local function has_flutter_dependency_in_pubspec(cwd)
235237 if not pubspec then return default_has_flutter_dependency end
236238 -- https://github.com/Dart-Code/Dart-Code/blob/43914cd2709d77668e19a4edf3500f996d5c307b/src/shared/utils/fs.ts#L183
237239 return (
238- pubspec .dependencies
239- and (
240- pubspec .dependencies .flutter
241- or pubspec .dependencies .flutter_test
242- or pubspec .dependencies .sky_engine
243- or pubspec .dependencies .flutter_goldens
244- )
245- )
246- or (
247- pubspec .devDependencies
248- and (
249- pubspec .devDependencies .flutter
250- or pubspec .devDependencies .flutter_test
251- or pubspec .devDependencies .sky_engine
252- or pubspec .devDependencies .flutter_goldens
240+ pubspec .dependencies
241+ and (
242+ pubspec .dependencies .flutter
243+ or pubspec .dependencies .flutter_test
244+ or pubspec .dependencies .sky_engine
245+ or pubspec .dependencies .flutter_goldens
246+ )
247+ )
248+ or (
249+ pubspec .devDependencies
250+ and (
251+ pubspec .devDependencies .flutter
252+ or pubspec .devDependencies .flutter_test
253+ or pubspec .devDependencies .sky_engine
254+ or pubspec .devDependencies .flutter_goldens
255+ )
253256 )
254- )
255257end
256258
257259--- @param opts RunOpts
@@ -494,7 +496,7 @@ local fvm_list_job = nil
494496--- Returns table<{name: string, status: active|global|nil}>
495497function M .fvm_list (callback )
496498 if not fvm_list_job then
497- fvm_list_job = Job :new ({ command = " fvm " , args = { " api" , " list" } })
499+ fvm_list_job = Job :new ({ command = fvm_name , args = { " api" , " list" } })
498500
499501 fvm_list_job :after_success (vim .schedule_wrap (function (j )
500502 local out = j :result ()
@@ -533,7 +535,7 @@ local fvm_use_job = nil
533535
534536function M .fvm_use (sdk_name )
535537 if not fvm_use_job then
536- fvm_use_job = Job :new ({ command = " fvm " , args = { " use" , sdk_name } })
538+ fvm_use_job = Job :new ({ command = fvm_name , args = { " use" , sdk_name } })
537539
538540 fvm_use_job :after_success (vim .schedule_wrap (function (j )
539541 ui .notify (utils .join (j :result ()))
0 commit comments