MCPcopy Create free account
hub / github.com/ashkulz/NppFTP / ClearCurrentCache

Method ClearCurrentCache

src/FTPCache.cpp:162–197  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

160}
161
162int FTPCache::ClearCurrentCache(bool permanent) {
163 SHFILEOPSTRUCT shfop;
164 TCHAR * dirPath = new TCHAR[MAX_PATH+1];
165
166 ZeroMemory(&shfop, sizeof(shfop));
167 shfop.hwnd = _MainOutputWindow;
168 shfop.wFunc = FO_DELETE;
169 shfop.pFrom = dirPath;
170 shfop.pTo = NULL;
171 shfop.fFlags = FOF_NOCONFIRMATION | FOF_NOCONFIRMMKDIR | FOF_NOERRORUI | FOF_SILENT;// | FOF_WANTNUKEWARNING;
172 if (!permanent) {
173 shfop.fFlags |= FOF_ALLOWUNDO; //use recycle bin
174 }
175 shfop.lpszProgressTitle = NULL;
176
177
178
179 for(size_t i = 0; i < m_vCachePaths.size(); i++) {
180 OutMsg("[Cache] Clearing cache in '%T'", m_vCachePaths[i].localpathExpanded);
181 lstrcpy(dirPath, m_vCachePaths[i].localpathExpanded);
182 int len = lstrlen(dirPath);
183 dirPath[len+1] = 0;
184 int res = SHFileOperation(&shfop);
185 if (res != 0) {
186 //Error may also be triggered if cache is empty, so stay silent
187 //OutErr("Failure clearing cache: %d", res);
188 }
189 }
190
191 delete [] dirPath;
192
193 if (m_cacheParent)
194 return m_cacheParent->ClearCurrentCache(permanent);
195
196 return 0;
197}
198
199TiXmlElement* FTPCache::SaveCache(const FTPCache * cache) {
200 TiXmlElement * cacheElem = new TiXmlElement(FTPCache::CacheElem);

Callers 1

OnDisconnectMethod · 0.80

Calls 1

sizeMethod · 0.80

Tested by

no test coverage detected