at 23.05-pre 72 lines 3.4 kB view raw
1diff --git a/packages/flutter_tools/lib/src/asset.dart b/packages/flutter_tools/lib/src/asset.dart 2index ed42baea29..12941f733a 100644 3--- a/packages/flutter_tools/lib/src/asset.dart 4+++ b/packages/flutter_tools/lib/src/asset.dart 5@@ -11,11 +11,11 @@ import 'base/file_system.dart'; 6 import 'base/logger.dart'; 7 import 'base/platform.dart'; 8 import 'build_info.dart'; 9-import 'cache.dart'; 10 import 'convert.dart'; 11 import 'dart/package_map.dart'; 12 import 'devfs.dart'; 13 import 'flutter_manifest.dart'; 14+import 'globals.dart' as globals; 15 import 'license_collector.dart'; 16 import 'project.dart'; 17 18@@ -504,7 +504,7 @@ class ManifestAssetBundle implements AssetBundle { 19 } 20 final Uri entryUri = _fileSystem.path.toUri(asset); 21 result.add(_Asset( 22- baseDir: _fileSystem.path.join(Cache.flutterRoot!, 'bin', 'cache', 'artifacts', 'material_fonts'), 23+ baseDir: _fileSystem.path.join(globals.fsUtils.homeDirPath!, '.cache', 'flutter', 'artifacts', 'material_fonts'), 24 relativeUri: Uri(path: entryUri.pathSegments.last), 25 entryUri: entryUri, 26 package: null, 27diff --git a/packages/flutter_tools/lib/src/cache.dart b/packages/flutter_tools/lib/src/cache.dart 28index defc86cc20..7fdf14d112 100644 29--- a/packages/flutter_tools/lib/src/cache.dart 30+++ b/packages/flutter_tools/lib/src/cache.dart 31@@ -22,6 +22,7 @@ import 'base/user_messages.dart'; 32 import 'build_info.dart'; 33 import 'convert.dart'; 34 import 'features.dart'; 35+import 'globals.dart' as globals; 36 37 const String kFlutterRootEnvironmentVariableName = 'FLUTTER_ROOT'; // should point to //flutter/ (root of flutter/flutter repo) 38 const String kFlutterEngineEnvironmentVariableName = 'FLUTTER_ENGINE'; // should point to //engine/src/ (root of flutter/engine repo) 39@@ -322,8 +323,13 @@ class Cache { 40 return; 41 } 42 assert(_lock == null); 43+ final Directory dir = _fileSystem.directory(_fileSystem.path.join(globals.fsUtils.homeDirPath!, '.cache', 'flutter')); 44+ if (!dir.existsSync()) { 45+ dir.createSync(recursive: true); 46+ globals.os.chmod(dir, '755'); 47+ } 48 final File lockFile = 49- _fileSystem.file(_fileSystem.path.join(flutterRoot!, 'bin', 'cache', 'lockfile')); 50+ _fileSystem.file(_fileSystem.path.join(globals.fsUtils.homeDirPath!, '.cache', 'flutter', 'lockfile')); 51 try { 52 _lock = lockFile.openSync(mode: FileMode.write); 53 } on FileSystemException catch (e) { 54@@ -382,8 +388,7 @@ class Cache { 55 56 String get devToolsVersion { 57 if (_devToolsVersion == null) { 58- const String devToolsDirPath = 'dart-sdk/bin/resources/devtools'; 59- final Directory devToolsDir = getCacheDir(devToolsDirPath, shouldCreate: false); 60+ final Directory devToolsDir = _fileSystem.directory(_fileSystem.path.join(flutterRoot!, 'bin/cache/dart-sdk/bin/resources/devtools')); 61 if (!devToolsDir.existsSync()) { 62 throw Exception('Could not find directory at ${devToolsDir.path}'); 63 } 64@@ -536,7 +541,7 @@ class Cache { 65 if (_rootOverride != null) { 66 return _fileSystem.directory(_fileSystem.path.join(_rootOverride!.path, 'bin', 'cache')); 67 } else { 68- return _fileSystem.directory(_fileSystem.path.join(flutterRoot!, 'bin', 'cache')); 69+ return _fileSystem.directory(_fileSystem.path.join(globals.fsUtils.homeDirPath!, '.cache', 'flutter')); 70 } 71 } 72