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

Function make_relative_path

source/runtime.cpp:67–79  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

65}
66
67static std::filesystem::path make_relative_path(const std::filesystem::path &path)
68{
69 if (path.empty())
70 return std::filesystem::path();
71 // Use ReShade DLL directory as base for relative paths (see 'resolve_path')
72 std::filesystem::path proximate_path = path.lexically_proximate(g_reshade_base_path);
73 if (proximate_path.wstring().rfind(L"..", 0) != std::wstring::npos)
74 return path; // Do not use relative path if preset is in a parent directory
75 if (proximate_path.is_relative() && !proximate_path.empty() && proximate_path.native().front() != L'.')
76 // Prefix preset path with dot character to better indicate it being a relative path
77 proximate_path = L"." / proximate_path;
78 return proximate_path;
79}
80
81static bool find_file(const std::vector<std::filesystem::path> &search_paths, std::filesystem::path &path)
82{

Callers 1

save_configMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected