Returns the path that should be used as base for relative paths.
| 72 | /// Returns the path that should be used as base for relative paths. |
| 73 | /// </summary> |
| 74 | std::filesystem::path get_base_path(bool default_to_target_executable_path = false) |
| 75 | { |
| 76 | std::filesystem::path path_override; |
| 77 | |
| 78 | // Cannot use global config here yet, since it uses base path for look up, so look at config file next to target executable instead |
| 79 | if (reshade::ini_file::load_cache(g_target_executable_path.parent_path() / L"ReShade.ini").get("INSTALL", "BasePath", path_override) && |
| 80 | resolve_env_path(path_override)) |
| 81 | return path_override; |
| 82 | |
| 83 | WCHAR buf[4096]; |
| 84 | path_override.assign(buf, buf + GetEnvironmentVariableW(L"RESHADE_BASE_PATH_OVERRIDE", buf, ARRAYSIZE(buf))); |
| 85 | if (resolve_env_path(path_override)) |
| 86 | return path_override; |
| 87 | |
| 88 | return default_to_target_executable_path ? g_target_executable_path.parent_path() : g_reshade_dll_path.parent_path(); |
| 89 | } |
| 90 | |
| 91 | /// <summary> |
| 92 | /// Returns the path to the Windows System32 directory. |