From 9e670d8dc71339658ec9a3560775b3393837e4ba Mon Sep 17 00:00:00 2001 From: Ron Koenderink Date: Tue, 7 Sep 2004 14:04:19 +0000 Subject: [PATCH] (info): `info' was not checking for all types of common files in Windows, therefore could miss info files depending on the status (archive, read-only). Also changed the error message to user to provide a more accurate description of the problem. Closes #1018297. --- src/lib/commands/info.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/lib/commands/info.c b/src/lib/commands/info.c index 0139afdd..a6d17021 100644 --- a/src/lib/commands/info.c +++ b/src/lib/commands/info.c @@ -409,11 +409,22 @@ info(void) strncat(filename, "*", sizeof(filename) - 1 - strlen(filename)); hDir = FindFirstFile(filename, &fData); if (hDir == INVALID_HANDLE_VALUE) { - pr("Can't open info dir \"%s\"\n", infodir); + switch (GetLastError()) { + case ERROR_FILE_NOT_FOUND: + pr("Sorry, there is no info on %s\n", bp); + break; + case ERROR_PATH_NOT_FOUND: + pr("Can't open info dir \"%s\"\n", infodir); + break; + default: + pr("Error getting info file \"%s\"\n", filename); + } return RET_SYS; } do { - if ((fData.dwFileAttributes == FILE_ATTRIBUTE_NORMAL) && + if (((fData.dwFileAttributes == FILE_ATTRIBUTE_NORMAL) || + (fData.dwFileAttributes == FILE_ATTRIBUTE_ARCHIVE) || + (fData.dwFileAttributes == FILE_ATTRIBUTE_READONLY)) && (strnccmp(bp, fData.cFileName, len) == 0)) { strncpy(filename, infodir, sizeof(filename) - 2); strcat(filename, "//");