| 65 | } |
| 66 | |
| 67 | static 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 | |
| 81 | static bool find_file(const std::vector<std::filesystem::path> &search_paths, std::filesystem::path &path) |
| 82 | { |