Don't show empty directories in the server list.

This commit is contained in:
Ludvig Strigeus 2018-10-22 00:29:08 +02:00
parent 29473fe75a
commit 335133fa8f
2 changed files with 7 additions and 0 deletions

View file

@ -25,6 +25,7 @@ Changes:
11.Show an error message and drop packets if the TUN queue grows
too large. This is a problem with the TAP NDIS6 driver on Win7.
12.Bundle the TunSafe-TAP installer instead of downloading it.
13.Don't show empty directories in the server list.
2018-10-08 - TunSafe v1.4

View file

@ -440,12 +440,18 @@ void ConfigMenuBuilder::Recurse() {
break;
if (wfd_.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) {
buf_[bufpos_ - 1] = '\\';
int old_nfiles = nfiles_;
depth_++;
if (depth_ < 16)
Recurse();
depth_--;
// Remove directory if it had no files
if (old_nfiles == nfiles_)
nfiles_--;
if (nfiles_ == MAX_CONFIG_FILES)
break;
}
bufpos_ = old_bufpos;
} while (FindNextFile(handle, &wfd_));