void ParseDirs(CAtlList<CString>& paths) { POSITION pos = paths.GetHeadPosition(); while (pos) { POSITION prevPos = pos; CString fn = paths.GetNext(pos); // Try to follow link files that point to a directory if (IsLinkFile(fn)) { fn = ResolveLinkFile(fn); } if (IsDir(fn)) { CAtlList<CString> subDirs; RecurseAddDir(fn, subDirs); // Add the subdirectories just after their parent // so that the tree is not parsed multiple times while (!subDirs.IsEmpty()) { paths.InsertAfter(prevPos, subDirs.RemoveTail()); } } } }