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

Method BrowseDirectory

src/PathUtils.cpp:287–315  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

285}
286
287int PU::BrowseDirectory(TCHAR * buffer, int bufSize, HWND hOwner) {
288 if (bufSize < MAX_PATH)
289 return -1;
290
291 if (!hOwner)
292 hOwner = _MainOutputWindow;
293 //TODO: detect Vista+ and use IFileDialog
294 BROWSEINFO bi{};
295 bi.hwndOwner = hOwner;
296 bi.pidlRoot = NULL; //desktop
297 bi.pszDisplayName = buffer;
298 bi.lpszTitle = TEXT("Please pick a location");
299 bi.ulFlags = 0;
300 bi.lpfn = NULL;
301 bi.lParam = 0;
302 bi.iImage = 0;
303
304 LPITEMIDLIST pidl = SHBrowseForFolder(&bi);
305 if (!pidl)
306 return -1;
307
308 BOOL bResult = SHGetPathFromIDList(pidl, buffer);
309 CoTaskMemFree(pidl);
310
311 if (bResult == FALSE)
312 return -1;
313
314 return 0;
315}
316
317int PU::SimplifyExternalPath(const char * path, const char * currentDir, char * buffer, int bufSize) {
318 if (buffer == NULL || bufSize <= 1)

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected