Skip to content

Instantly share code, notes, and snippets.

@adam-singer
Created May 13, 2012 02:05
Show Gist options
  • Save adam-singer/2670283 to your computer and use it in GitHub Desktop.
Save adam-singer/2670283 to your computer and use it in GitHub Desktop.
Bug with DirectoryLister not able to handle broken symbolic links
#import('dart:io');
main() {
/*
Create a bad symlink and run 'dart symlinkbug.dart'
ln -s /usr/local/doesnotexist badlink
*/
var files = [];
var dirs = [];
var d = new Directory("/tmp");
var cwd = d.path;
DirectoryLister dl = d.list();
dl.onDir = (dir) {
dirs.add(dir);
};
dl.onFile = (file) {
files.add(file);
};
dl.onDone = (done) {
var f = {"files": files, "dirs": dirs};
print(f);
};
dl.onError = (e) {
// After the first broken link found the
// DirectoryLister does not continue to run.
print("error = ${e}");
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment