examples/make_torrent.cpp
// do not include files and folders whose
// name starts with a .
do not include files and folders whose
name starts with a .
do not include files and folders whose name starts with a .
bool file_filter(std::string const& f)
{
	if (f.empty()) return false;
	char const* first = f.c_str();
	char const* sep = strrchr(first, '/');
#if defined(TORRENT_WINDOWS) || defined(TORRENT_OS2)
	char const* altsep = strrchr(first, '\\');
	if (sep == 0 || altsep > sep) sep = altsep;
#endif
	if (sep == 0 && f[0] == '.') return false;
	if (sep[1] == '.') return false;
	fprintf(stderr, "%s\n", f.c_str());
	return true;
}
bool file_filter ( std :: string const & f ) { if ( f . empty ( ) ) return false ; char const * first = f . c_str ( ) ; char const * sep = strrchr ( first , ' ' ) ; #if defined ( TORRENT_WINDOWS ) || defined ( TORRENT_OS2 ) char const * altsep = strrchr ( first , ' \\ ' ) ; if ( sep == 0 || altsep > sep ) sep = altsep ; #endif if ( sep == 0 && f [ 0 ] == ' ' ) return false ; if ( sep [ 1 ] == ' ' ) return false ; fprintf ( stderr , " \n " , f . c_str ( ) ) ; return true ; }
do not include files and folders whose
name starts with a .
do not include files and folders whose name starts with a .
// return false if the first character of the filename is a .