commit | d6795a92d517b173279bed8ac3082986453e4624 | [log] [tgz] |
---|---|---|
author | Todd Volkert <tvolkert@users.noreply.github.com> | Wed Feb 22 13:20:39 2017 -0800 |
committer | GitHub <noreply@github.com> | Wed Feb 22 13:20:39 2017 -0800 |
tree | f74157e113b5f3289877ddffe047eedc3cd6d5c9 | |
parent | d9dad578414b301c0addb307864b97892fb7d078 [diff] |
Update code to use errno values (#44) This updates all code that throws FileSystemException to properly set the corresponding osError.errorCode, which allows us to update the tests to expect the error code rather than the error message. This in turn allows the tests to be more robust across locales and platforms. To deal with the fact that different platforms have different errno values (which will be exposed and tested via LocalFileSystem), this change creates an ErrorCodes class with static getters for the set of errno values that are common to all platforms. This code can be removed once dart-lang/sdk#28860 is resolved and live. Fixes #43
A generic file system abstraction for Dart.
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/memory.dart'; var fs = new MemoryFileSystem();
Use the local file system (requires dart:io access):
import 'package:file/local.dart'; var fs = const LocalFileSystem();