blob: 0751e7959289dcfa2b5377703ce20188262086e9 [file] [log] [blame]
// Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
part of file.src.backends.local;
/// A wrapper implementation around `dart:io`'s implementation.
/// Since this implementation of the [FileSystem] interface delegates to
/// `dart:io`, is is not suitable for use in the browser.
class LocalFileSystem extends FileSystem {
/// Creates a new `LocalFileSystem`.
const LocalFileSystem();
Directory directory(dynamic path) =>
new _LocalDirectory(this, shim.newDirectory(path));
File file(dynamic path) => new _LocalFile(this, shim.newFile(path));
Link link(dynamic path) => new _LocalLink(this, shim.newLink(path));
p.Context get path => new p.Context();
/// Gets the directory provided by the operating system for creating temporary
/// files and directories in. The location of the system temp directory is
/// platform-dependent, and may be set by an environment variable.
Directory get systemTempDirectory =>
new _LocalDirectory(this, shim.systemTemp());
Directory get currentDirectory => directory(shim.currentDirectory.path);
set currentDirectory(dynamic path) => shim.currentDirectory = path;
Future<io.FileStat> stat(String path) => shim.stat(path);
io.FileStat statSync(String path) => shim.statSync(path);
Future<bool> identical(String path1, String path2) =>
shim.identical(path1, path2);
bool identicalSync(String path1, String path2) =>
shim.identicalSync(path1, path2);
bool get isWatchSupported => shim.isWatchSupported;
Future<io.FileSystemEntityType> type(String path, {bool followLinks: true}) =>
shim.type(path, followLinks);
io.FileSystemEntityType typeSync(String path, {bool followLinks: true}) =>
shim.typeSync(path, followLinks);