Browse Source

core: replace uv_fs_readdir with uv_fs_scandir

PR-URL: https://github.com/joyent/node/pull/8566
Reviewed-by: Fedor Indutny <fedor@indutny.com>
Reviewed-by: Trevor Norris <trev.norris@gmail.com>
v0.11.15-release
Saúl Ibarra Corretgé 11 years ago
committed by Trevor Norris
parent
commit
a5f1307e45
  1. 10
      src/node_file.cc

10
src/node_file.cc

@ -205,7 +205,7 @@ static void After(uv_fs_t *req) {
argv[1] = Integer::New(env->isolate(), req->result);
break;
case UV_FS_READDIR:
case UV_FS_SCANDIR:
{
int r;
Local<Array> names = Array::New(env->isolate(), 0);
@ -213,7 +213,7 @@ static void After(uv_fs_t *req) {
for (int i = 0; ; i++) {
uv_dirent_t ent;
r = uv_fs_readdir_next(req, &ent);
r = uv_fs_scandir_next(req, &ent);
if (r == UV_EOF)
break;
if (r != 0) {
@ -710,9 +710,9 @@ static void ReadDir(const FunctionCallbackInfo<Value>& args) {
node::Utf8Value path(args[0]);
if (args[1]->IsFunction()) {
ASYNC_CALL(readdir, args[1], *path, 0 /*flags*/)
ASYNC_CALL(scandir, args[1], *path, 0 /*flags*/)
} else {
SYNC_CALL(readdir, *path, *path, 0 /*flags*/)
SYNC_CALL(scandir, *path, *path, 0 /*flags*/)
assert(SYNC_REQ.result >= 0);
int r;
@ -721,7 +721,7 @@ static void ReadDir(const FunctionCallbackInfo<Value>& args) {
for (int i = 0; ; i++) {
uv_dirent_t ent;
r = uv_fs_readdir_next(&SYNC_REQ, &ent);
r = uv_fs_scandir_next(&SYNC_REQ, &ent);
if (r == UV_EOF)
break;
if (r != 0)

Loading…
Cancel
Save