commit | d11edcafb31666346b92ab06c4d3f283409013c7 | [log] [tgz] |
---|---|---|
author | Todd Volkert <tvolkert@users.noreply.github.com> | Fri Dec 16 14:43:44 2016 -0800 |
committer | GitHub <noreply@github.com> | Fri Dec 16 14:43:44 2016 -0800 |
tree | ee68d5456e0dbe8d167d751d786f47e9de53c3ea | |
parent | 67e015a039ef2217eebb7e4fea69d42f8763496b [diff] |
Test LocalFileSystem without using ChrootFileSystem (#23) While the original intent of ChrootFileSystem was inspired by the idea that we could use it to test LocalFileSystem (chroot'ed to a tmp folder), it turns out that ChrootFileSystem adds too much abstraction and gets in the way of actually testing LocalFileSystem. ChrootFileSystem is still valuable in its own right, but this change updates local_test.dart to test LocalFileSystem without the need for ChrootFileSystem, by factoring common_tests.dart to accept a root folder argument and do all its work in that folder.
A generic file system abstraction for Dart.
This package is currently experimental and subject to change
Like dart:io
, package:file
supplies a rich Dart-idiomatic API for accessing a file system.
Unlike dart:io
, package:file
:
Implement your own custom file system:
import 'package:file/file.dart'; class FooBarFileSystem implements FileSystem { ... }
Use the in-memory file system:
import 'package:file/file.dart'; var fs = new InMemoryFileSystem();
Use the local file system (requires dart:io access):
import 'package:file/io.dart'; var fs = const LocalFileSystem();
The synchronous counterparts can be imported from:
// API and in-memory implementation import `package:file/sync.dart`; // Implementation based on "dart:io" import `package:file/sync_io.dart`;