about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/compilers/flutter/patches/move-cache.patch
blob: d6a45a97e581a8b8cb3e4de8f4b4c3d26984a47f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
diff --git a/packages/flutter_tools/lib/src/asset.dart b/packages/flutter_tools/lib/src/asset.dart
index a6c59bae07..21f6c9812a 100644
--- a/packages/flutter_tools/lib/src/asset.dart
+++ b/packages/flutter_tools/lib/src/asset.dart
@@ -5,6 +5,7 @@
 import 'package:meta/meta.dart';
 import 'package:package_config/package_config.dart';
 
+import 'base/common.dart';
 import 'base/context.dart';
 import 'base/file_system.dart';
 import 'base/logger.dart';
@@ -14,6 +15,7 @@ import 'cache.dart';
 import 'convert.dart';
 import 'dart/package_map.dart';
 import 'devfs.dart';
+import 'globals.dart' as globals;
 import 'flutter_manifest.dart';
 import 'license_collector.dart';
 import 'project.dart';
@@ -377,7 +379,7 @@ class ManifestAssetBundle implements AssetBundle {
       for (final Map<String, Object> font in family['fonts'] as List<Map<String, Object>>) {
         final Uri entryUri = _fileSystem.path.toUri(font['asset'] as String);
         result.add(_Asset(
-          baseDir: _fileSystem.path.join(Cache.flutterRoot, 'bin', 'cache', 'artifacts', 'material_fonts'),
+          baseDir: _fileSystem.path.join(globals.fsUtils.homeDirPath, '.cache', 'flutter', 'artifacts', 'material_fonts'),
           relativeUri: Uri(path: entryUri.pathSegments.last),
           entryUri: entryUri,
           package: null,
diff --git a/packages/flutter_tools/lib/src/cache.dart b/packages/flutter_tools/lib/src/cache.dart
index 11e3bf3e11..39d6fae0d1 100644
--- a/packages/flutter_tools/lib/src/cache.dart
+++ b/packages/flutter_tools/lib/src/cache.dart
@@ -321,8 +321,15 @@ class Cache {
       return;
     }
     assert(_lock == null);
+
+    final Directory dir = _fileSystem.directory(_fileSystem.path.join(globals.fsUtils.homeDirPath, '.cache', 'flutter'));
+    if (!dir.existsSync()) {
+      dir.createSync(recursive: true);
+      globals.os.chmod(dir, '755');
+    }
+
     final File lockFile =
-      _fileSystem.file(_fileSystem.path.join(flutterRoot, 'bin', 'cache', 'lockfile'));
+      _fileSystem.file(_fileSystem.path.join(globals.fsUtils.homeDirPath, '.cache', 'flutter', 'lockfile'));
     try {
       _lock = lockFile.openSync(mode: FileMode.write);
     } on FileSystemException catch (e) {
@@ -424,7 +431,7 @@ class Cache {
     if (_rootOverride != null) {
       return _fileSystem.directory(_fileSystem.path.join(_rootOverride.path, 'bin', 'cache'));
     } else {
-      return _fileSystem.directory(_fileSystem.path.join(flutterRoot, 'bin', 'cache'));
+      return _fileSystem.directory(_fileSystem.path.join(globals.fsUtils.homeDirPath, '.cache', 'flutter'));
     }
   }