fix file_filter bug in make_torrent.cpp

This commit is contained in:
Arvid Norberg 2015-04-29 04:33:00 +00:00
parent 73a24ffc0e
commit 0c2f5c67b8
1 changed files with 8 additions and 3 deletions

View File

@ -143,11 +143,16 @@ bool file_filter(std::string const& f)
char const* sep = strrchr(first, '/');
#if defined(TORRENT_WINDOWS) || defined(TORRENT_OS2)
char const* altsep = strrchr(first, '\\');
if (sep == 0 || altsep > sep) sep = altsep;
if (sep == NULL || altsep > sep) sep = altsep;
#endif
// if there is no parent path, just set 'sep'
// to point to the filename.
// if there is a parent path, skip the '/' character
if (sep == NULL) sep = first;
else ++sep;
// return false if the first character of the filename is a .
if (sep == 0 && f[0] == '.') return false;
if (sep[1] == '.') return false;
if (sep[0] == '.') return false;
fprintf(stderr, "%s\n", f.c_str());
return true;