void CTSVNPathList::DeleteAllPaths(bool bTrash, bool bFilesOnly, HWND hErrorWnd) { if (m_paths.empty()) return; PathVector::const_iterator it; SortByPathname (true); // nested ones first CString sPaths; for (it = m_paths.begin(); it != m_paths.end(); ++it) { if ((it->Exists())&&((it->IsDirectory() != bFilesOnly)||!bFilesOnly)) { if (!it->IsDirectory()) ::SetFileAttributes(it->GetWinPath(), FILE_ATTRIBUTE_NORMAL); sPaths += it->GetWinPath(); sPaths += '\0'; } } if (sPaths.IsEmpty()) return; sPaths += '\0'; sPaths += '\0'; DeleteViaShell((LPCTSTR)sPaths, bTrash, hErrorWnd); Clear(); }
bool CTGitPathList::AreAllPathsFilesInOneDirectory() const { // Check if all the paths are files and in the same directory PathVector::const_iterator it; m_commonBaseDirectory.Reset(); for(it = m_paths.begin(); it != m_paths.end(); ++it) { if(it->IsDirectory()) { return false; } const CTGitPath& baseDirectory = it->GetDirectory(); if(m_commonBaseDirectory.IsEmpty()) { m_commonBaseDirectory = baseDirectory; } else if(!m_commonBaseDirectory.IsEquivalentTo(baseDirectory)) { // Different path m_commonBaseDirectory.Reset(); return false; } } return true; }