mirror of https://github.com/PCSX2/pcsx2.git
fs-api: extend host API to allow retrieval of a resource file path
This commit is contained in:
parent
e313eadcd2
commit
4719e52c6e
|
@ -41,4 +41,7 @@ namespace Host
|
||||||
|
|
||||||
/// Reads a resource file file from the resources directory as a string.
|
/// Reads a resource file file from the resources directory as a string.
|
||||||
std::optional<std::string> ReadResourceFileToString(const char* filename);
|
std::optional<std::string> ReadResourceFileToString(const char* filename);
|
||||||
|
|
||||||
|
/// Returns the full filepath to a resource file, if it exists.
|
||||||
|
std::optional<std::string> getResourceFilePath(const char* filename);
|
||||||
} // namespace Host
|
} // namespace Host
|
||||||
|
|
|
@ -66,3 +66,14 @@ std::optional<std::string> Host::ReadResourceFileToString(const char* filename)
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::optional<std::string> Host::getResourceFilePath(const char* filename)
|
||||||
|
{
|
||||||
|
const std::string full_filename(Path::CombineStdString(EmuFolders::Resources, filename));
|
||||||
|
if (!FileSystem::FileExists(full_filename.c_str()))
|
||||||
|
{
|
||||||
|
Console.Error("Resource file does not exist '%s'", filename);
|
||||||
|
return std::nullopt;
|
||||||
|
}
|
||||||
|
return full_filename;
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue