getUserPackageConfig2 function

Future<PackageConfig> getUserPackageConfig2 ()

get PackageConfig for ~/.dart.d/

Implementation

//FIXME: rename to getHomePkgConfig
Future<PackageConfig> getUserPackageConfig2() async {
  Config.ppLogger.i('getUserPackageConfig2');

  var dartConfigDirPath = Config.home + '/.dartrix.d';
  if (!verifyExists(dartConfigDirPath)) {
    // dartConfigDirPath = Config.home + '/.dart';
    // if (!verifyExists(dartConfigDirPath)) {
    Config.ppLogger.e('dartConfigDirPath (~/.dart.d or ~/.dart) not found)');
    exit(0);
    // }
  }
  // if (Config.debug) {
  //   Config.ppLogger.v('found dartConfigDirPath: $dartConfigDirPath');
  // }
  Directory dartConfigDir;
  dartConfigDir = Directory(dartConfigDirPath);
  PackageConfig userPackageConfig2;
  // fn from package_config.package_config_discovery Package class

  try {
    // findPackageConfig loads `.dart_tool/package_config.json` (version 2) or a
    // `.packages` (version 1) file.
    userPackageConfig2 = await findPackageConfig(dartConfigDir);
    // onError: (e) => Config.logger.e(e));
  } catch (e) {
    Config.ppLogger.e(e);
    exit(0);
  }
  // print('pcfg2: $userPackageConfig2');
  // Config.logger.i('listing packages:');
  // userPackageConfig2.packages.forEach((pkg) => _log.fine('${pkg.name}'));
  return userPackageConfig2;
}