Unix: prioritize local resource directory over installed one.

pull/33/head
whitequark 2016-07-19 09:31:58 +00:00
parent cbf84a9d2b
commit 33e292a6bc
1 changed files with 6 additions and 4 deletions

View File

@ -1536,11 +1536,13 @@ const void *LoadResource(const std::string &name, size_t *size) {
struct stat st;
std::string path;
path = (UNIX_DATADIR "/") + name;
if(stat(path.c_str(), &st)) {
ssassert(errno == ENOENT, "Unexpected stat() error");
ssassert(!resource_dir.empty(), "Expected local resource directory to be set");
if(resource_dir.empty()) {
path = (UNIX_DATADIR "/") + name;
} else {
path = resource_dir + "/" + name;
}
if(stat(path.c_str(), &st)) {
ssassert(!stat(path.c_str(), &st), "Cannot find resource");
}