@@ -6,6 +6,7 @@ import 'dart:io';
6
6
import 'dart:convert' ;
7
7
8
8
import 'package:cli_pkg/cli_pkg.dart' as pkg;
9
+ import 'package:cli_util/cli_util.dart' ;
9
10
import 'package:grinder/grinder.dart' ;
10
11
import 'package:http/http.dart' as http;
11
12
import 'package:path/path.dart' as p;
@@ -15,22 +16,8 @@ import 'package:yaml/yaml.dart';
15
16
import 'utils.dart' ;
16
17
17
18
/// The path in which pub expects to find its credentials file.
18
- final String _pubCredentialsPath = () {
19
- // This follows the same logic as pub:
20
- // https://github.com/dart-lang/pub/blob/d99b0d58f4059d7bb4ac4616fd3d54ec00a2b5d4/lib/src/system_cache.dart#L34-L43
21
- String cacheDir;
22
- var pubCache = Platform .environment['PUB_CACHE' ];
23
- if (pubCache != null ) {
24
- cacheDir = pubCache;
25
- } else if (Platform .isWindows) {
26
- var appData = Platform .environment['APPDATA' ]! ;
27
- cacheDir = p.join (appData, 'Pub' , 'Cache' );
28
- } else {
29
- cacheDir = p.join (Platform .environment['HOME' ]! , '.pub-cache' );
30
- }
31
-
32
- return p.join (cacheDir, 'credentials.json' );
33
- }();
19
+ final String _pubCredentialsPath =
20
+ p.join (applicationConfigHome ('dart' ), 'pub-credentials.json' );
34
21
35
22
@Task ('Deploy sub-packages to pub.' )
36
23
Future <void > deploySubPackages () async {
0 commit comments