MCPcopy Create free account
hub / github.com/crosire/reshade / resolve_env_path

Function resolve_env_path

source/dll_main.cpp:53–69  ·  view source on GitHub ↗

Expands any environment variables in the path (like "%USERPROFILE%") and checks whether it points towards an existing directory.

Source from the content-addressed store, hash-verified

51/// Expands any environment variables in the path (like "%USERPROFILE%") and checks whether it points towards an existing directory.
52/// </summary>
53static bool resolve_env_path(std::filesystem::path &path, const std::filesystem::path &base = g_reshade_dll_path.parent_path())
54{
55 if (path.empty())
56 return false;
57
58 WCHAR buf[4096];
59 if (ExpandEnvironmentStringsW(path.c_str(), buf, ARRAYSIZE(buf)))
60 path = buf;
61 else
62 return false;
63
64 path = base / path;
65
66 std::error_code ec;
67 path = std::filesystem::canonical(path, ec);
68 return !ec && std::filesystem::is_directory(path, ec);
69}
70
71/// <summary>
72/// Returns the path that should be used as base for relative paths.

Callers 1

get_base_pathFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected