MCPcopy Create free account
hub / github.com/OpenLoco/OpenLoco / SHGetPathFromIDListLongPath

Function SHGetPathFromIDListLongPath

src/Platform/src/Platform.Windows.cpp:48–68  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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 {

Callers 1

promptDirectoryFunction · 0.85

Calls 3

findMethod · 0.80
sizeMethod · 0.45
resizeMethod · 0.45

Tested by

no test coverage detected