Пример #1
0
			void run(const stdex::tString &dir)
			{
				filesystem::find_file find;

				assert(dir.length() > 1);
				stdex::tString tmp = dir;
				if( tmp[tmp.length() - 1] != '\\' ||
					tmp[tmp.length() - 1] != '/' )
					tmp += _T("\\");
				tmp += _T("*");

				bool bSuc = find.find(tmp.c_str());
				while( bSuc )
				{
					bSuc = find.find_next();
					if( !bSuc )
						break;

					if( find.is_dots() )
						continue;

					if( cond_(find) )
					{
						op_(find.get_file_path());
					}

					if( is_sub_dir_ && find.is_directory() )
					{
						run(find.get_file_path());
					}
				}
			}
Пример #2
0
			void _run_impl(const stdex::tString &dir, size_t depth)
			{
				assert(dir.length() > 1);
				if( depth_ != 0 && (depth < 0 || depth >= depth_) )
					return;

				std::vector<stdex::tString> curDirectorys;
				filesystem::find_file find;

				stdex::tString tmp = dir;
				if( tmp[tmp.length() - 1] != '\\' ||
					tmp[tmp.length() - 1] != '/' )
					tmp += _T("\\");
				tmp += _T("*");

				bool bSuc = find.find(tmp.c_str());
				while( bSuc )
				{
					bSuc = find.find_next();
					if( !bSuc )
						break;

					if( find.is_dots() )
						continue;

					if( cond_(find) )
					{
						op_(find.get_file_path());
					}

					if( find.is_directory() )
					{
						curDirectorys.push_back(find.get_file_path());
					}
				}

				std::for_each(curDirectorys.begin(), curDirectorys.end(),
					std::bind(&ThisType::_run_impl, this, std::placeholders::_1, depth + 1));
			}