| 3464 | } |
| 3465 | |
| 3466 | QString WindowsSystem::GetSystemPath(int SystemLocation) |
| 3467 | { |
| 3468 | // return the cached value if possible |
| 3469 | if (_virtualIconTypePathMap.contains(SystemLocation)) |
| 3470 | return _virtualIconTypePathMap[SystemLocation]; |
| 3471 | |
| 3472 | QString pathStr; |
| 3473 | TCHAR path[MAX_PATH]; |
| 3474 | |
| 3475 | if (SystemLocation == DesktopDirectory) |
| 3476 | { |
| 3477 | // special case for the sandbox mode |
| 3478 | if (scnManager->isInSandboxMode) |
| 3479 | pathStr = native(winOS->GetExecutableDirectory() / "SandboxDesktop"); |
| 3480 | |
| 3481 | // special case for unit testing mode |
| 3482 | else if (scnManager->runBumpTopTestsOnStartup) |
| 3483 | pathStr = native(winOS->GetExecutableDirectory() / "UnitTestDesktop"); |
| 3484 | |
| 3485 | if (!pathStr.isEmpty()) |
| 3486 | { |
| 3487 | _virtualIconTypePathMap.insert(Desktop, pathStr); |
| 3488 | return pathStr; |
| 3489 | } |
| 3490 | } |
| 3491 | |
| 3492 | LPITEMIDLIST itemIdList; |
| 3493 | |
| 3494 | // Retrieve the Desktop path |
| 3495 | if (SUCCEEDED(SHGetSpecialFolderLocation(NULL, SystemLocation, &itemIdList))) |
| 3496 | { |
| 3497 | if (SUCCEEDED(SHGetPathFromIDList(itemIdList, path))) |
| 3498 | { |
| 3499 | // set the path string |
| 3500 | pathStr = QString::fromUtf16((const ushort *) path); |
| 3501 | LOG(QString_NT("special folder %1: %2").arg(SystemLocation).arg(pathStr)); |
| 3502 | _virtualIconTypePathMap.insert(SystemLocation, pathStr); |
| 3503 | } |
| 3504 | CoTaskMemFree(itemIdList); |
| 3505 | } |
| 3506 | |
| 3507 | return pathStr; |
| 3508 | } |
| 3509 | |
| 3510 | QDir WindowsSystem::GetUserApplicationDataPath() |
| 3511 | { |
no test coverage detected