Clean up usage of temporary directories (#20682)

All temporary directory start with `flutter_` and have their random component separated from the name by a period, as in `flutter_test_bundle.YFYQMY`.

I've tried to find some of the places where we didn't cleanly delete temporary directories, too. This greatly reduces, though it does not entirely eliminate, the directories we leave behind when running tests, especially `flutter_tools` tests.

While I was at it I standardized on `tempDir` as the variable name for temporary directories, since it was the most common, removing occurrences of `temp` and `tmp`, among others.

Also I factored out some common code that used to catch exceptions that happen on Windows, and made more places use that pattern.
This commit is contained in:
Ian Hickson
2018-08-17 13:17:23 -07:00
committed by GitHub
parent d581208557
commit 3dec6a6930
51 changed files with 339 additions and 346 deletions

View File

@@ -244,7 +244,7 @@ void createIndexAndCleanup() {
void removeOldFlutterDocsDir() {
try {
new Directory('$kDocRoot/flutter').deleteSync(recursive: true);
} catch (e) {
} on FileSystemException {
// If the directory does not exist, that's OK.
}
}