diff --git a/lib/src/commands/doctor_command.dart b/lib/src/commands/doctor_command.dart index 43a52b8e..7c0a5dea 100644 --- a/lib/src/commands/doctor_command.dart +++ b/lib/src/commands/doctor_command.dart @@ -1,3 +1,4 @@ +import 'package:fvm/src/version.dart'; import 'package:io/io.dart'; import 'package:process_run/shell.dart'; @@ -33,6 +34,9 @@ class DoctorCommand extends BaseCommand { final cacheVersion = await CacheService.getByVersionName(project.pinnedVersion!); FvmLogger.spacer(); + + FvmLogger.info('FVM Version: $packageVersion'); + FvmLogger.divider(); FvmLogger.fine('FVM config found:'); FvmLogger.divider(); FvmLogger.info('Project: ${project.name}'); @@ -84,6 +88,9 @@ class DoctorCommand extends BaseCommand { FvmLogger.info('Dart:'); FvmLogger.info(dartWhich ?? ''); FvmLogger.spacer(); + FvmLogger.info('FVM_HOME:'); + FvmLogger.info(kEnvVars['FVM_HOME'] ?? 'not set'); + FvmLogger.spacer(); return ExitCode.success.code; } diff --git a/lib/src/commands/flutter_command.dart b/lib/src/commands/flutter_command.dart index bd8975bc..7a9d0d8c 100644 --- a/lib/src/commands/flutter_command.dart +++ b/lib/src/commands/flutter_command.dart @@ -34,8 +34,7 @@ class FlutterCommand extends BaseCommand { // Runs flutter command with pinned version return await flutterCmd(cacheVersion, args); } else { - // Running null will default to flutter version on path - + // Running null will default to flutter version on paths return await flutterGlobalCmd(args); } } diff --git a/lib/src/services/config_service.dart b/lib/src/services/config_service.dart index 6d1a9b43..68369536 100644 --- a/lib/src/services/config_service.dart +++ b/lib/src/services/config_service.dart @@ -30,7 +30,7 @@ class ConfigService { /// Updates link for the project SDK from the [config] static Future updateSdkLink(FvmConfig config) async { - await createLink(config.sdkSymlink, File(config.flutterSdkPath)); + await createLink(config.sdkSymlink, Directory(config.flutterSdkPath)); } /// Saves a fvm [config] diff --git a/lib/src/utils/helpers.dart b/lib/src/utils/helpers.dart index 2eb60c9b..f05ad433 100644 --- a/lib/src/utils/helpers.dart +++ b/lib/src/utils/helpers.dart @@ -54,9 +54,18 @@ Future getParentDirPath(String filePath) async { /// Creates a symlink from [source] to the [target] Future createLink(Link source, FileSystemEntity target) async { try { - if (await source.exists()) { + // Check if needs to do anything + // TODO: Move this check higher up the stack + final sourceExists = await source.exists(); + if (sourceExists && await source.target() == target.path) { + logger.trace('Link is setup correctly'); + return; + } + + if (sourceExists) { await source.delete(); } + await source.create( target.path, recursive: true, diff --git a/pubspec.yaml b/pubspec.yaml index b0088f97..10989a11 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -26,8 +26,7 @@ dev_dependencies: build_runner: ^2.0.1 build_version: ^2.0.3 effective_dart: ^1.3.1 - cli_pkg: - git: https://github.com/leoafarias/dart_cli_pkg + cli_pkg: ^1.3.0 grinder: ^0.9.0 test: ^1.17.2 diff --git a/tool/grind.dart b/tool/grind.dart index cee4595b..18a83f95 100644 --- a/tool/grind.dart +++ b/tool/grind.dart @@ -1,5 +1,5 @@ -import 'package:grinder/grinder.dart'; import 'package:cli_pkg/cli_pkg.dart' as pkg; +import 'package:grinder/grinder.dart'; void main(List args) { pkg.name.value = 'fvm';