Jisho-Study-Tool/nix/flutter_patches/move-cache.patch

78 lines
3.4 KiB
Diff

diff --git i/packages/flutter_tools/lib/src/asset.dart w/packages/flutter_tools/lib/src/asset.dart
index ed42baea29..e7308372e7 100644
--- i/packages/flutter_tools/lib/src/asset.dart
+++ w/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/deferred_component.dart';
import 'base/file_system.dart';
@@ -16,6 +17,7 @@ import 'convert.dart';
import 'dart/package_map.dart';
import 'devfs.dart';
import 'flutter_manifest.dart';
+import 'globals.dart' as globals;
import 'license_collector.dart';
import 'project.dart';
@@ -504,7 +506,7 @@ class ManifestAssetBundle implements AssetBundle {
}
final Uri entryUri = _fileSystem.path.toUri(asset);
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 i/packages/flutter_tools/lib/src/cache.dart w/packages/flutter_tools/lib/src/cache.dart
index defc86cc20..5078375f02 100644
--- i/packages/flutter_tools/lib/src/cache.dart
+++ w/packages/flutter_tools/lib/src/cache.dart
@@ -22,6 +22,7 @@ import 'base/user_messages.dart';
import 'build_info.dart';
import 'convert.dart';
import 'features.dart';
+import 'globals.dart' as globals;
const String kFlutterRootEnvironmentVariableName = 'FLUTTER_ROOT'; // should point to //flutter/ (root of flutter/flutter repo)
const String kFlutterEngineEnvironmentVariableName = 'FLUTTER_ENGINE'; // should point to //engine/src/ (root of flutter/engine repo)
@@ -322,8 +323,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) {
@@ -383,7 +391,8 @@ class Cache {
String get devToolsVersion {
if (_devToolsVersion == null) {
const String devToolsDirPath = 'dart-sdk/bin/resources/devtools';
- final Directory devToolsDir = getCacheDir(devToolsDirPath, shouldCreate: false);
+ final Directory devToolsDir =
+ _fileSystem.directory(_fileSystem.path.join(flutterRoot!, 'bin', 'cache', devToolsDirPath));
if (!devToolsDir.existsSync()) {
throw Exception('Could not find directory at ${devToolsDir.path}');
}
@@ -536,7 +545,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'));
}
}