nall: Use the value of datadir to find the assets dir.

This commit is contained in:
orbea 2020-12-28 10:57:28 -08:00
parent 8a6b89d032
commit adafcb4430
3 changed files with 6 additions and 0 deletions

View File

@ -12,6 +12,9 @@ auto locate(string name) -> string {
location = {Path::userData(), "bsnes/", name};
if(inode::exists(location)) return location;
location = {Path::sharedData(), "bsnes/", name};
if(inode::exists(location)) return location;
directory::create({Path::userSettings(), "bsnes/"});
return {Path::userSettings(), "bsnes/", name};
}

View File

@ -243,4 +243,5 @@ else
bindir ?= $(prefix)/bin
datarootdir ?= $(prefix)/share
datadir ?= $(datarootdir)
flags += -DDATADIR=\"$(datadir)\"
endif

View File

@ -137,6 +137,8 @@ inline auto sharedData() -> string {
result.transform("\\", "/");
#elif defined(PLATFORM_MACOS)
string result = "/Library/Application Support/";
#elif defined(DATADIR)
string result = DATADIR;
#else
string result = "/usr/share/";
#endif