summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xconfigure.ac9
-rw-r--r--src/fs/paths.cpp7
2 files changed, 16 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac
index 7d16fde20..ecc6ee35a 100755
--- a/configure.ac
+++ b/configure.ac
@@ -667,6 +667,15 @@ AM_CONDITIONAL(ENABLE_UNITTESTSBIN, test x$unittestsbin_enabled = xtrue)
AM_CONDITIONAL(ENABLE_UNITTESTSBIN_CATCH, test x$unittestsbin_catch = xtrue)
AM_CONDITIONAL(ENABLE_UNITTESTSBIN_DOCTEST, test x$unittestsbin_doctest = xtrue)
+# Override home directory for unit tests
+AC_ARG_WITH(unittestsdir,[ --with-unittestsdir override home directory for unit tests ] )
+if test "x$with_unittestsdir" == "xno"; then
+ with_unittestsdir=no
+else
+ with_unittestsdir=yes
+ CPPFLAGS="$CPPFLAGS -DUNITESTSDIR=$withval"
+fi
+
# Enable tcmalloc
AC_ARG_ENABLE(tcmalloc,
[ --enable-tcmalloc Turn on tcmalloc],
diff --git a/src/fs/paths.cpp b/src/fs/paths.cpp
index 4eaf6ac60..5698ffa7d 100644
--- a/src/fs/paths.cpp
+++ b/src/fs/paths.cpp
@@ -231,6 +231,12 @@ std::string getPicturesDir()
std::string getHomePath()
{
+#if defined(UNITTESTS) && defined(UNITESTSDIR)
+ std::string dir = UNITESTSDIR;
+ if (findLast(dir, std::string(dirSeparator)) == false)
+ dir += dirSeparator;
+ return dir;
+#else // defined(UNITTESTS) && defined(UNITESTSDIR)
#ifdef WIN32
return getSpecialFolderLocation(CSIDL_LOCAL_APPDATA);
#else
@@ -252,6 +258,7 @@ std::string getHomePath()
dir += dirSeparator;
return dir;
#endif // WIN32
+#endif // defined(UNITTESTS) && defined(UNITESTSDIR)
}
#ifdef ANDROID