Skip to content

Commit

Permalink
maestro_cli: change default artifact path to $HOME/.cache/maestro
Browse files Browse the repository at this point in the history
  • Loading branch information
bartekpacia committed Aug 12, 2022
1 parent afc02c3 commit 5c126e5
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions packages/maestro_cli/lib/src/common/artifacts_repository.dart
Original file line number Diff line number Diff line change
Expand Up @@ -83,20 +83,25 @@ class ArtifactsRepository {
_createFileRecursively(p).writeAsBytesSync(response.bodyBytes);
}

String get _defaultArtifactPath => path.join(_homeDirPath, '.maestro');
String get _defaultArtifactPath {
if (Platform.isWindows) {
return path.join(_homeDirPath, '.maestro');
} else {
return path.join(_homeDirPath, './.cache/maestro');
}
}

String get _homeDirPath {
String? home;
final envVars = Platform.environment;
if (Platform.isMacOS) {
home = envVars['HOME'];
return envVars['HOME']!;
} else if (Platform.isLinux) {
home = envVars['HOME'];
return envVars['HOME']!;
} else if (Platform.isWindows) {
home = envVars['UserProfile'];
return envVars['UserProfile']!;
} else {
throw Exception('Cannot find home directory. Unsupported platform');
}

return home!;
}

/// Create a file at [fullPath], recursively creating non-existent
Expand Down

0 comments on commit 5c126e5

Please sign in to comment.