HRESULT CFSFolder::LoadSubItems(CDirItem &dirItem, const UString &path) { { CEnumeratorW enumerator(path + L"*"); CDirItem fileInfo; while (enumerator.Next(fileInfo)) { fileInfo.CompressedSizeIsDefined = false; /* if (!GetCompressedFileSize(_path + fileInfo.Name, fileInfo.CompressedSize)) fileInfo.CompressedSize = fileInfo.Size; */ if (fileInfo.IsDir()) { // fileInfo.Size = GetFolderSize(_path + fileInfo.Name); fileInfo.Size = 0; } dirItem.Files.Add(fileInfo); } } if (!_flatMode) return S_OK; for (int i = 0; i < dirItem.Files.Size(); i++) { CDirItem &item = dirItem.Files[i]; if (item.IsDir()) LoadSubItems(item, path + item.Name + WCHAR_PATH_SEPARATOR); } return S_OK; }
void CFileBrowserListCtrl::OpenItem(int ItemIdx) { // copy item instead of referencing it, because SetFolder changes m_DirList CDirItem Item = m_DirList.GetItem(ItemIdx); CString ItemPath = GetItemPath(ItemIdx); // grab item path now too if (Item.IsDir()) { // if user selected parent folder and current folder is a root folder if (Item.IsDots() && PathIsRoot(GetFolder())) SetFolder(_T("")); // list drives else SetFolder(ItemPath); } NMFBOPENITEM nmoi; nmoi.pszPath = ItemPath; nmoi.bIsDir = Item.IsDir(); Notify(FBLCN_OPENITEM, &nmoi); }
HRESULT CFSFolder::LoadSubItems(int dirItem, const FString &relPrefix) { unsigned startIndex = Folders.Size(); { CEnumerator enumerator; enumerator.SetDirPrefix(_path + relPrefix); CDirItem fi; fi.FolderStat_Defined = false; fi.NumFolders = 0; fi.NumFiles = 0; fi.Parent = dirItem; while (enumerator.Next(fi)) { if (fi.IsDir()) { fi.Size = 0; if (_flatMode) Folders.Add(relPrefix + fi.Name + FCHAR_PATH_SEPARATOR); } else { /* fi.PackSize_Defined = true; if (!MyGetCompressedFileSizeW(_path + relPrefix + fi.Name, fi.PackSize)) fi.PackSize = fi.Size; */ } #ifndef UNDER_CE fi.Reparse.Free(); fi.PackSize_Defined = false; #ifdef FS_SHOW_LINKS_INFO fi.FileInfo_Defined = false; fi.FileInfo_WasRequested = false; fi.FileIndex = 0; fi.NumLinks = 0; #endif fi.PackSize = fi.Size; if (fi.HasReparsePoint()) { fi.FileInfo_WasRequested = true; BY_HANDLE_FILE_INFORMATION info; NIO::GetReparseData(_path + relPrefix + fi.Name, fi.Reparse, &info); fi.NumLinks = info.nNumberOfLinks; fi.FileIndex = (((UInt64)info.nFileIndexHigh) << 32) + info.nFileIndexLow; fi.FileInfo_Defined = true; } #endif /* unsigned fileIndex = */ Files.Add(fi); #if defined(_WIN32) && !defined(UNDER_CE) /* if (_scanAltStreams) { CStreamEnumerator enumerator(_path + relPrefix + fi.Name); CStreamInfo si; for (;;) { bool found; if (!enumerator.Next(si, found)) { // if (GetLastError() == ERROR_ACCESS_DENIED) // break; // return E_FAIL; break; } if (!found) break; if (si.IsMainStream()) continue; CAltStream ss; ss.Parent = fileIndex; ss.Name = si.GetReducedName(); ss.Size = si.Size; ss.PackSize_Defined = false; ss.PackSize = si.Size; Streams.Add(ss); } } */ #endif } } if (!_flatMode) return S_OK; unsigned endIndex = Folders.Size(); for (unsigned i = startIndex; i < endIndex; i++) LoadSubItems(i, Folders[i]); return S_OK; }