STDMETHODIMP CUpdateCallback100Imp::ScanProgress(UInt64 /* numFolders */, UInt64 numFiles, UInt64 totalSize, const wchar_t *path, Int32 /* isDir */) { return ProgressDialog->Sync.ScanProgress(numFiles, totalSize, us2fs(path)); }
bool GetFullPath(CFSTR dirPrefix, CFSTR s, FString &res) { res = s; #ifdef UNDER_CE if (s[0] != CHAR_PATH_SEPARATOR) { if (!dirPrefix) return false; res = dirPrefix; res += s; } #else unsigned prefixSize = GetRootPrefixSize(s); if (prefixSize != 0) { if (!AreThereDotsFolders(s + prefixSize)) return true; UString rem = fs2us(s + prefixSize); if (!ResolveDotsFolders(rem)) return true; // maybe false; res.DeleteFrom(prefixSize); res += us2fs(rem); return true; } /* FChar c = s[0]; if (c == 0) return true; if (c == '.' && (s[1] == 0 || (s[1] == '.' && s[2] == 0))) return true; if (c == CHAR_PATH_SEPARATOR && s[1] == CHAR_PATH_SEPARATOR) return true; if (IsDrivePath(s)) return true; */ UString curDir; if (dirPrefix) curDir = fs2us(dirPrefix); else { if (!GetCurDir(curDir)) return false; } if (!curDir.IsEmpty() && curDir.Back() != WCHAR_PATH_SEPARATOR) curDir += WCHAR_PATH_SEPARATOR; unsigned fixedSize = 0; if (IsDrivePath(curDir)) fixedSize = kDrivePrefixSize; UString temp; if (s[0] == CHAR_PATH_SEPARATOR) { temp = fs2us(s + 1); } else { temp += curDir.Ptr(fixedSize); temp += fs2us(s); } if (!ResolveDotsFolders(temp)) return false; curDir.DeleteFrom(fixedSize); res = us2fs(curDir); res += us2fs(temp); #endif // UNDER_CE return true; }
int CExtToIconMap::GetIconIndex(DWORD attrib, const wchar_t *fileName /*, UString *typeName */) { int dotPos = -1; unsigned i; for (i = 0;; i++) { wchar_t c = fileName[i]; if (c == 0) break; if (c == '.') dotPos = i; } /* if (MyStringCompareNoCase(fileName, L"$Recycle.Bin") == 0) { char s[256]; sprintf(s, "SPEC i = %3d, attr = %7x", _attribMap.Size(), attrib); OutputDebugStringA(s); OutputDebugStringW(fileName); } */ if ((attrib & FILE_ATTRIBUTE_DIRECTORY) != 0 || dotPos < 0) { int insertPos = 0; int index = FindInSorted_Attrib(_attribMap, attrib, insertPos); if (index >= 0) { // if (typeName) *typeName = _attribMap[index].TypeName; return _attribMap[index].IconIndex; } CAttribIconPair pair; GetRealIconIndex( #ifdef UNDER_CE FTEXT("\\") #endif FTEXT("__DIR__") , attrib, pair.IconIndex // , pair.TypeName ); /* char s[256]; sprintf(s, "i = %3d, attr = %7x", _attribMap.Size(), attrib); OutputDebugStringA(s); */ pair.Attrib = attrib; _attribMap.Insert(insertPos, pair); // if (typeName) *typeName = pair.TypeName; return pair.IconIndex; } const wchar_t *ext = fileName + dotPos + 1; int insertPos = 0; int index = FindInSorted_Ext(_extMap, ext, insertPos); if (index >= 0) { const CExtIconPair &pa = _extMap[index]; // if (typeName) *typeName = pa.TypeName; return pa.IconIndex; } for (i = 0;; i++) { wchar_t c = ext[i]; if (c == 0) break; if (c < L'0' || c > L'9') break; } if (i != 0 && ext[i] == 0) { // GetRealIconIndex is too slow for big number of split extensions: .001, .002, .003 if (!SplitIconIndex_Defined) { GetRealIconIndex( #ifdef UNDER_CE FTEXT("\\") #endif FTEXT("__FILE__.001"), 0, SplitIconIndex); SplitIconIndex_Defined = true; } return SplitIconIndex; } CExtIconPair pair; pair.Ext = ext; GetRealIconIndex(us2fs(fileName + dotPos), attrib, pair.IconIndex); _extMap.Insert(insertPos, pair); // if (typeName) *typeName = pair.TypeName; return pair.IconIndex; }