| 4325 | } |
| 4326 | |
| 4327 | IShellFolder2 * WindowsSystem::GetShellFolderFromAbsDirPath( QString p ) |
| 4328 | { |
| 4329 | // Assumes given path is a directory |
| 4330 | |
| 4331 | LPITEMIDLIST pidl = NULL; |
| 4332 | IShellFolder2 * psfFolder = NULL; |
| 4333 | |
| 4334 | // namespace extension root (desktop) for parsing path |
| 4335 | LPSHELLFOLDER psfDesktop = NULL; |
| 4336 | if (FAILED(SHGetDesktopFolder(&psfDesktop))) |
| 4337 | return psfFolder; |
| 4338 | |
| 4339 | // parse path for absolute pidl, and connect to target folder |
| 4340 | if (FAILED(psfDesktop->ParseDisplayName(NULL, NULL, (LPWSTR) p.utf16(), NULL, &pidl, NULL))) |
| 4341 | return psfFolder; |
| 4342 | |
| 4343 | // now get the parent shell folder |
| 4344 | if (FAILED(psfDesktop->BindToObject(pidl, NULL, IID_IShellFolder2, (void**)&psfFolder))) |
| 4345 | return psfFolder; |
| 4346 | |
| 4347 | // cleanup |
| 4348 | CoTaskMemFree(pidl); |
| 4349 | psfDesktop->Release(); // no longer required |
| 4350 | |
| 4351 | return psfFolder; |
| 4352 | } |
| 4353 | |
| 4354 | |
| 4355 | LPITEMIDLIST WindowsSystem::GetAbsolutePidlFromAbsFilePath( QString p ) |
no test coverage detected