fix redundant exists check and error-reporting problemss in directory-list
svn: r6038
This commit is contained in:
parent
7c0ea5b79c
commit
eeb65e6e53
|
@ -4620,14 +4620,6 @@ static Scheme_Object *do_directory_list(int break_ok, int argc, Scheme_Object *a
|
|||
}
|
||||
}
|
||||
|
||||
if (filename && !scheme_directory_exists(filename)) {
|
||||
if (break_ok)
|
||||
scheme_raise_exn(MZEXN_FAIL_FILESYSTEM,
|
||||
"directory-list: could not open \"%q\"",
|
||||
filename);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
# ifdef USE_FINDFIRST
|
||||
|
||||
if (!filename)
|
||||
|
@ -4671,11 +4663,14 @@ static Scheme_Object *do_directory_list(int break_ok, int argc, Scheme_Object *a
|
|||
|
||||
hfile = FIND_FIRST(WIDE_PATH(pattern), &info);
|
||||
if (FIND_FAILED(hfile)) {
|
||||
if (!filename)
|
||||
return scheme_null;
|
||||
if (break_ok)
|
||||
scheme_raise_exn(MZEXN_FAIL_FILESYSTEM,
|
||||
"directory-list: could not open \"%q\" (%E)",
|
||||
filename,
|
||||
GetLastError());
|
||||
return scheme_null;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
do {
|
||||
|
@ -4711,8 +4706,16 @@ static Scheme_Object *do_directory_list(int break_ok, int argc, Scheme_Object *a
|
|||
# else
|
||||
|
||||
dir = opendir(filename ? filename : ".");
|
||||
if (!dir)
|
||||
if (!dir) {
|
||||
if (!filename)
|
||||
return scheme_null;
|
||||
if (break_ok)
|
||||
scheme_raise_exn(MZEXN_FAIL_FILESYSTEM,
|
||||
"directory-list: could not open \"%q\" (%e)",
|
||||
filename,
|
||||
errno);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
while ((e = readdir(dir))) {
|
||||
# ifdef DIRENT_NO_NAMLEN
|
||||
|
|
Loading…
Reference in New Issue
Block a user