X-Git-Url: https://git.distorted.org.uk/u/mdw/putty/blobdiff_plain/c523f55f691aeb12b77d1e779707bea43eb242dd..8c7d710ce382c85e38ce4fb73fd357e00e7d5ed2:/winsftp.c diff --git a/winsftp.c b/winsftp.c index a4dafd4a..6687210f 100644 --- a/winsftp.c +++ b/winsftp.c @@ -303,6 +303,7 @@ DirHandle *open_directory(char *name) h = FindFirstFile(findfile, &fdat); if (h == INVALID_HANDLE_VALUE) return NULL; + sfree(findfile); ret = snew(DirHandle); ret->h = h; @@ -312,11 +313,18 @@ DirHandle *open_directory(char *name) char *read_filename(DirHandle *dir) { - if (!dir->name) { + while (!dir->name) { WIN32_FIND_DATA fdat; int ok = FindNextFile(dir->h, &fdat); - if (ok) + if (!ok) + return NULL; + + if (fdat.cFileName[0] == '.' && + (fdat.cFileName[1] == '\0' || + (fdat.cFileName[1] == '.' && fdat.cFileName[2] == '\0'))) + dir->name = NULL; + else dir->name = dupstr(fdat.cFileName); } @@ -449,6 +457,11 @@ int create_directory(char *name) return CreateDirectory(name, NULL) != 0; } +char *dir_file_cat(char *dir, char *file) +{ + return dupcat(dir, "\\", file, NULL); +} + /* ---------------------------------------------------------------------- * Platform-specific network handling. */