| 285 | } |
| 286 | |
| 287 | int 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 | |
| 317 | int PU::SimplifyExternalPath(const char * path, const char * currentDir, char * buffer, int bufSize) { |
| 318 | if (buffer == NULL || bufSize <= 1) |
nothing calls this directly
no outgoing calls
no test coverage detected