MCPcopy Create free account
hub / github.com/NVIDIAGameWorks/Falcor / resolveEnvVariables

Function resolveEnvVariables

Source/Falcor/Utils/PathResolving.cpp:37–62  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

35{
36
37bool resolveEnvVariables(std::string& str, EnvVarResolver envResolver, std::string_view beginToken, std::string_view endToken)
38{
39 FALCOR_ASSERT(envResolver);
40
41 std::string::size_type begin = str.find_first_of(beginToken);
42 if (begin == std::string::npos)
43 return true;
44
45 std::string result = str.substr(0, begin);
46 while (begin != std::string::npos)
47 {
48 std::string::size_type end = str.find_first_of(endToken, begin);
49 // Didn't find a matching end
50 if (end == std::string::npos)
51 return false;
52 std::string envVar = str.substr(begin + 2, end - begin - 2);
53 std::string resolved = envResolver(envVar).value_or("");
54 result += resolved;
55
56 begin = str.find_first_of(beginToken, end);
57 result += str.substr(end + 1, begin - end - 1);
58 }
59
60 str = std::move(result);
61 return true;
62}
63
64ResolvedPaths resolveSearchPaths(
65 const std::vector<std::filesystem::path>& current,

Callers 2

resolveSearchPathsFunction · 0.85
CPU_TESTFunction · 0.85

Calls

no outgoing calls

Tested by 1

CPU_TESTFunction · 0.68