Commit edcea220 by Maarten L. Hekkelman

search data_dir as well as cache_dir, for MacOS

parent a92e85f8
...@@ -47,9 +47,10 @@ CCP4DIR = @CCP4@ ...@@ -47,9 +47,10 @@ CCP4DIR = @CCP4@
CLIBD = $(CCP4DIR:%=%/lib/data) CLIBD = $(CCP4DIR:%=%/lib/data)
CACHE_DIR = $(DESTDIR)/var/cache/libcifpp CACHE_DIR = $(DESTDIR)/var/cache/libcifpp
DATA_DIR = $(datadir)/libcifpp
CRON_DIR = $(DESTDIR)/etc/cron.weekly CRON_DIR = $(DESTDIR)/etc/cron.weekly
DEFINES += CACHE_DIR='"$(CACHE_DIR)"' DEFINES += CACHE_DIR='"$(CACHE_DIR)"' DATA_DIR='"$(DATA_DIR)"'
GNUmakefile: config.status GNUmakefile.in GNUmakefile: config.status GNUmakefile.in
$(SHELL) ./config.status $(SHELL) ./config.status
......
...@@ -8427,6 +8427,8 @@ func_stripname_cnf () ...@@ -8427,6 +8427,8 @@ func_stripname_cnf ()
esac esac
} # func_stripname_cnf } # func_stripname_cnf
case $host in #(
*-apple-*) :
...@@ -16066,6 +16068,11 @@ ac_compiler_gnu=$ac_cv_cxx_compiler_gnu ...@@ -16066,6 +16068,11 @@ ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
# Only expand once: # Only expand once:
;; #(
*) :
;;
esac
......
...@@ -52,9 +52,12 @@ dnl AC_MSG_RESULT(ok) ...@@ -52,9 +52,12 @@ dnl AC_MSG_RESULT(ok)
AC_PROG_INSTALL AC_PROG_INSTALL
dnl Shared libraries are not convenient, esp. on MacOS... sigh dnl disable shared libraries on MacOS... sigh
dnl LT_INIT AS_CASE([$host],
LT_INIT([disable-shared]) [*-apple-*], [LT_INIT([disable-shared])],
[LT_INIT]
)
AC_SUBST(LIBTOOL_DEPS) AC_SUBST(LIBTOOL_DEPS)
dnl versioning, first for libtool dnl versioning, first for libtool
......
...@@ -1171,9 +1171,20 @@ std::unique_ptr<std::istream> loadResource(std::filesystem::path name) ...@@ -1171,9 +1171,20 @@ std::unique_ptr<std::istream> loadResource(std::filesystem::path name)
std::unique_ptr<std::istream> result; std::unique_ptr<std::istream> result;
fs::path p = name; fs::path p = name;
if (not fs::exists(p)) if (not fs::exists(p))
p = fs::path(CACHE_DIR) / p; {
for (const char* dir: { CACHE_DIR, DATA_DIR })
{
auto p2 = fs::path(dir) / p;
if (fs::exists(p2))
{
swap(p, p2);
break;
}
}
}
if (fs::exists(p)) if (fs::exists(p))
{ {
std::unique_ptr<std::ifstream> file(new std::ifstream(p)); std::unique_ptr<std::ifstream> file(new std::ifstream(p));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment