HOME property

String get HOME

Gets the path to the user's home directory using the enviornment var appropriate for the user's OS.

Implementation

//ignore: non_constant_identifier_names
String get HOME {
  String? home;

  if (Settings().isWindows) {
    home = _env('APPDATA');
  } else {
    home = _env('HOME');
  }

  if (home == null) {
    if (Settings().isWindows) {
      throw DCliException(
        "Unable to find the 'APPDATA' enviroment variable. "
        'Ensure it is set and try again.',
      );
    } else {
      throw DCliException(
        "Unable to find the 'HOME' enviroment variable. "
        'Ensure it is set and try again.',
      );
    }
  }
  return home;
}