Unverified Commit 04afff38 authored by Elias Yishak's avatar Elias Yishak Committed by GitHub

Catch error for missing directory in `FontConfigManager` (#138496)

Closes:
- https://github.com/flutter/flutter/issues/138434

We will catch any errors while attempting to clear the temp directories that don't exist for the `FontConfigManager` class
parent 2afec776
......@@ -34,7 +34,11 @@ class FontConfigManager {
Future<void> dispose() async {
if (_fontsDirectory != null) {
globals.printTrace('Deleting ${_fontsDirectory!.path}...');
await _fontsDirectory!.delete(recursive: true);
try {
await _fontsDirectory!.delete(recursive: true);
} on FileSystemException {
// Silently exit
}
_fontsDirectory = null;
}
}
......
......@@ -50,6 +50,18 @@ void main() {
uriConverter: (String input) => '$input/converted',
);
testUsingContext('Missing dir error caught for FontConfigManger.dispose', () async {
final FontConfigManager fontConfigManager = FontConfigManager();
final Directory fontsDirectory = fileSystem.file(fontConfigManager.fontConfigFile).parent;
fontsDirectory.deleteSync(recursive: true);
await fontConfigManager.dispose();
}, overrides: <Type, Generator>{
FileSystem: () => fileSystem,
ProcessManager: () => processManager,
});
group('The FLUTTER_TEST environment variable is passed to the test process', () {
setUp(() {
processManager = FakeProcessManager.list(<FakeCommand>[]);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment