MCPcopy Create free account
hub / github.com/M2Team/NanaBox / GetLocalStateFolderPath

Function GetLocalStateFolderPath

NanaBox/Utils.cpp:608–640  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

606}
607
608std::wstring GetLocalStateFolderPath()
609{
610 static std::wstring CachedResult = ([]() -> std::wstring
611 {
612 std::wstring FolderPath;
613 {
614 LPWSTR RawFolderPath = nullptr;
615 // KF_FLAG_FORCE_APP_DATA_REDIRECTION, when engaged, causes
616 // SHGetKnownFolderPath to return the new AppModel paths
617 // (Packages/xxx/RoamingState, etc.) for standard path requests.
618 // Using this flag allows us to avoid
619 // Windows.Storage.ApplicationData completely.
620 winrt::check_hresult(::SHGetKnownFolderPath(
621 FOLDERID_LocalAppData,
622 KF_FLAG_FORCE_APP_DATA_REDIRECTION,
623 nullptr,
624 &RawFolderPath));
625 FolderPath = std::wstring(RawFolderPath);
626 if (!Mile::WinRT::IsPackagedMode())
627 {
628 FolderPath += L"\\M2-Team\\NanaBox";
629 }
630 ::CoTaskMemFree(RawFolderPath);
631 }
632
633 // Create the directory if it doesn't exist.
634 ::MileCreateDirectory(FolderPath.c_str());
635
636 return FolderPath;
637 }());
638
639 return CachedResult;
640}
641
642std::wstring GetCurrentProcessModulePath()
643{

Callers 1

wWinMainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected