| 46 | } |
| 47 | |
| 48 | static std::wstring SHGetPathFromIDListLongPath(LPCITEMIDLIST pidl) |
| 49 | { |
| 50 | std::wstring pszPath(MAX_PATH, 0); |
| 51 | while (!SHGetPathFromIDListW(pidl, &pszPath[0])) |
| 52 | { |
| 53 | if (pszPath.size() >= SHRT_MAX) |
| 54 | { |
| 55 | // Clearly not succeeding at all, bail |
| 56 | return std::wstring(); |
| 57 | } |
| 58 | pszPath.resize(pszPath.size() * 2); |
| 59 | } |
| 60 | |
| 61 | auto nullBytePos = pszPath.find(L'\0'); |
| 62 | if (nullBytePos != std::wstring::npos) |
| 63 | { |
| 64 | pszPath.resize(nullBytePos); |
| 65 | } |
| 66 | |
| 67 | return pszPath; |
| 68 | } |
| 69 | |
| 70 | fs::path promptDirectory(const std::string& title, void* hwnd) |
| 71 | { |
no test coverage detected