fs.traversePath(path) works if path is a symlink

This commit is contained in:
Corey Johnson 2012-10-12 15:42:20 -07:00
parent c43c82fbcb
commit de03cc82ed
3 changed files with 14 additions and 1 deletions

View File

@ -104,7 +104,7 @@ bool Native::Execute(const CefString& name,
strcpy(rootPath, argument.c_str());
char * const paths[] = {rootPath, NULL};
FTS *tree = fts_open(paths, FTS_PHYSICAL| FTS_NOCHDIR | FTS_NOSTAT, NULL);
FTS *tree = fts_open(paths, FTS_COMFOLLOW | FTS_PHYSICAL| FTS_NOCHDIR | FTS_NOSTAT, NULL);
if (tree == NULL) {
return true;
}

1
spec/fixtures/symlink-to-dir vendored Symbolic link
View File

@ -0,0 +1 @@
dir

View File

@ -90,6 +90,18 @@ describe "fs", ->
for path in paths
expect(path).not.toMatch /\/dir\//
it "returns entries if path is a symlink", ->
symlinkPaths = []
onSymlinkPath = (path) -> symlinkPaths.push(path)
paths = []
onPath = (path) -> paths.push(path)
fs.traverseTree(fs.join(fixturesDir, 'symlink-to-dir'), onSymlinkPath, onSymlinkPath)
fs.traverseTree(fs.join(fixturesDir, 'dir'), onPath, onPath)
expect(symlinkPaths).toEqual(paths)
describe ".lastModified(path)", ->
it "returns a Date object representing the time the file was last modified", ->
beforeWrite = new Date