mirror of https://github.com/vitalif/phantomjs
Spotted a mistake in "scandir.[js|coffee]": was still using "phantom.fs" API.
parent
e71a992dbd
commit
3046bd994e
|
@ -4,10 +4,10 @@ if phantom.args.length != 1
|
|||
console.log "Usage: phantomjs scandir.js DIRECTORY_TO_SCAN"
|
||||
phantom.exit()
|
||||
scanDirectory = (path) ->
|
||||
if phantom.fs.exists(path) and phantom.fs.isFile(path)
|
||||
if fs.exists(path) and fs.isFile(path)
|
||||
console.log path
|
||||
else if phantom.fs.isDir(path)
|
||||
phantom.fs.list(path).forEach (e) ->
|
||||
else if fs.isDirectory(path)
|
||||
fs.list(path).forEach (e) ->
|
||||
scanDirectory path + "/" + e if e != "." and e != ".."
|
||||
|
||||
scanDirectory phantom.args[0]
|
||||
|
|
|
@ -6,10 +6,10 @@ if (phantom.args.length !== 1) {
|
|||
}
|
||||
|
||||
var scanDirectory = function (path) {
|
||||
if (phantom.fs.exists(path) && phantom.fs.isFile(path)) {
|
||||
if (fs.exists(path) && fs.isFile(path)) {
|
||||
console.log(path);
|
||||
} else if (phantom.fs.isDir(path)) {
|
||||
phantom.fs.list(path).forEach(function (e) {
|
||||
} else if (fs.isDirectory(path)) {
|
||||
fs.list(path).forEach(function (e) {
|
||||
if ( e !== "." && e !== ".." ) { //< Avoid loops
|
||||
scanDirectory(path + '/' + e);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue