winget-cli

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

Filesystem.cpp (1028B)


      1 // Copyright (c) Microsoft Corporation.
      2 // Licensed under the MIT License.
      3 #include "pch.h"
      4 #include "Filesystem.h"
      5 
      6 using namespace std::string_view_literals;
      7 
      8 namespace winrt::Microsoft::Management::Configuration::implementation
      9 {
     10     namespace anon
     11     {
     12         constexpr std::string_view s_Configuration_LocalState = "Configuration"sv;
     13     }
     14 
     15     AppInstaller::Filesystem::PathDetails GetPathDetailsFor(PathName path, bool forDisplay)
     16     {
     17         AppInstaller::Filesystem::PathDetails result;
     18         // We should not create directories by default when they are retrieved for display purposes.
     19         result.Create = !forDisplay;
     20 
     21         switch (path)
     22         {
     23         case PathName::LocalState:
     24             result = GetPathDetailsFor(AppInstaller::Filesystem::PathName::UnpackagedLocalStateRoot, forDisplay);
     25             result.Path /= anon::s_Configuration_LocalState;
     26             break;
     27         default:
     28             THROW_HR(E_UNEXPECTED);
     29         }
     30 
     31         return result;
     32     }
     33 }