3
0
Fork 0
forked from mirrors/nixpkgs
nixpkgs/pkgs/development/compilers/flutter/patches/move-cache.patch

68 lines
2.8 KiB
Diff
Raw Normal View History

diff --git a/packages/flutter_tools/lib/src/asset.dart b/packages/flutter_tools/lib/src/asset.dart
2021-06-10 18:53:58 +01:00
index 80fb16673f..5723f93f9f 100644
--- a/packages/flutter_tools/lib/src/asset.dart
+++ b/packages/flutter_tools/lib/src/asset.dart
2021-06-10 18:53:58 +01:00
@@ -7,6 +7,7 @@
2021-03-21 13:06:57 +00:00
import 'package:meta/meta.dart';
2020-06-17 17:27:50 +01:00
import 'package:package_config/package_config.dart';
+import 'base/common.dart';
import 'base/context.dart';
2021-06-10 18:53:58 +01:00
import 'base/deferred_component.dart';
import 'base/file_system.dart';
2021-06-10 18:53:58 +01:00
@@ -16,6 +17,7 @@ import 'build_info.dart';
import 'cache.dart';
2021-03-21 13:06:57 +00:00
import 'convert.dart';
import 'dart/package_map.dart';
+import 'globals.dart' as globals;
2021-06-10 18:53:58 +01:00
import 'devfs.dart';
2021-03-21 13:06:57 +00:00
import 'flutter_manifest.dart';
import 'license_collector.dart';
2021-06-10 18:53:58 +01:00
@@ -449,7 +451,7 @@ class ManifestAssetBundle implements AssetBundle {
2021-03-21 13:06:57 +00:00
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
2021-06-10 18:53:58 +01:00
index 152d4e75e5..1fcff7e2bd 100644
--- a/packages/flutter_tools/lib/src/cache.dart
+++ b/packages/flutter_tools/lib/src/cache.dart
2021-06-10 18:53:58 +01:00
@@ -9,6 +9,7 @@ import 'package:file/memory.dart';
import 'package:meta/meta.dart';
import 'package:process/process.dart';
+import 'globals.dart' as globals;
import 'base/common.dart';
import 'base/error_handling_io.dart';
import 'base/file_system.dart';
@@ -298,8 +299,15 @@ class Cache {
return;
}
assert(_lock == null);
+
2021-06-10 18:53:58 +01:00
+ final Directory dir = _fileSystem.directory(_fileSystem.path.join(globals.fsUtils.homeDirPath!, '.cache', 'flutter'));
+ if (!dir.existsSync()) {
+ dir.createSync(recursive: true);
2020-06-17 17:27:50 +01:00
+ globals.os.chmod(dir, '755');
+ }
2020-06-17 17:27:50 +01:00
+
final File lockFile =
2021-06-10 18:53:58 +01:00
- _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) {
2021-06-10 18:53:58 +01:00
@@ -404,7 +412,7 @@ class Cache {
if (_rootOverride != null) {
2021-06-10 18:53:58 +01:00
return _fileSystem.directory(_fileSystem.path.join(_rootOverride!.path, 'bin', 'cache'));
} else {
2021-06-10 18:53:58 +01:00
- return _fileSystem.directory(_fileSystem.path.join(flutterRoot!, 'bin', 'cache'));
+ return _fileSystem.directory(_fileSystem.path.join(globals.fsUtils.homeDirPath!, '.cache', 'flutter'));
}
}