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 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. too large. This is a problem with the TAP NDIS6 driver on Win7.
12.Bundle the TunSafe-TAP installer instead of downloading it. 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 2018-10-08 - TunSafe v1.4

View file

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