common.dart 1.06 KB
Newer Older
Ian Hickson's avatar
Ian Hickson committed
1
// Copyright 2014 The Flutter Authors. All rights reserved.
2 3 4
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

5 6
// @dart = 2.8

7 8
import 'dart:io' show Platform;

9
import 'package:file/file.dart';
10 11
import 'package:file/local.dart';
import 'package:file/memory.dart';
12 13 14 15

/// The file system implementation used by this library.
///
/// See [useMemoryFileSystemForTesting] and [restoreFileSystem].
16
FileSystem fs = const LocalFileSystem();
17 18 19 20

/// Overrides the file system so it can be tested without hitting the hard
/// drive.
void useMemoryFileSystemForTesting() {
21
  fs = MemoryFileSystem();
22 23 24 25
}

/// Restores the file system to the default local file system implementation.
void restoreFileSystem() {
26
  fs = const LocalFileSystem();
27
}
28

29
/// Flutter Driver test output directory.
30 31 32 33 34
///
/// Tests should write any output files to this directory. Defaults to the path
/// set in the FLUTTER_TEST_OUTPUTS_DIR environment variable, or `build` if
/// unset.
String get testOutputsDirectory => Platform.environment['FLUTTER_TEST_OUTPUTS_DIR'] ?? 'build';