MCPcopy Create free account
hub / github.com/GPUOpen-Tools/GPU-Reshape / ExpandPath

Function ExpandPath

Source/Test/Automation/Source/Parser.cpp:79–102  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

77}
78
79static std::filesystem::path ExpandPath(const std::filesystem::path &path) {
80 std::string str = path.string();
81
82#if _WIN32
83 // Determine the expected size
84 DWORD size = ExpandEnvironmentStringsA(str.c_str(), nullptr, 0);
85 if (size == 0) {
86 return path;
87 }
88
89 // Preallocate exapnded
90 std::string expanded;
91 expanded.resize(size - 1u);
92
93 // For +1u, see https://learn.microsoft.com/en-us/windows/win32/api/processenv/nf-processenv-expandenvironmentstringsa
94 ExpandEnvironmentStringsA(str.c_str(), expanded.data(), size + 1u);
95 expanded.pop_back();
96
97 // OK
98 return expanded;
99#else // _WIN32
100#error Not implemented
101#endif // _WIN32
102}
103
104bool Parser::ParseApplication(const nlohmann::json &json, ComRef<ITestPass>& out) {
105 ApplicationInfo info;

Callers 2

ParseApplicationMethod · 0.85

Calls 3

resizeMethod · 0.80
dataMethod · 0.80
pop_backMethod · 0.80

Tested by

no test coverage detected