From adafcb4430b6115e4e91e7fe1b5ff3059df1914f Mon Sep 17 00:00:00 2001 From: orbea Date: Mon, 28 Dec 2020 10:57:28 -0800 Subject: [PATCH] nall: Use the value of datadir to find the assets dir. --- bsnes/target-bsnes/bsnes.cpp | 3 +++ nall/GNUmakefile | 1 + nall/path.hpp | 2 ++ 3 files changed, 6 insertions(+) diff --git a/bsnes/target-bsnes/bsnes.cpp b/bsnes/target-bsnes/bsnes.cpp index c7bb3dd3..5c07e06b 100644 --- a/bsnes/target-bsnes/bsnes.cpp +++ b/bsnes/target-bsnes/bsnes.cpp @@ -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}; } diff --git a/nall/GNUmakefile b/nall/GNUmakefile index c3df2838..dcca2b6d 100755 --- a/nall/GNUmakefile +++ b/nall/GNUmakefile @@ -243,4 +243,5 @@ else bindir ?= $(prefix)/bin datarootdir ?= $(prefix)/share datadir ?= $(datarootdir) + flags += -DDATADIR=\"$(datadir)\" endif diff --git a/nall/path.hpp b/nall/path.hpp index 3353817b..a9f0b496 100644 --- a/nall/path.hpp +++ b/nall/path.hpp @@ -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