$OpenBSD: patch-xpcom_io_TorFileUtils_cpp,v 1.3 2018/10/03 14:55:36 sthen Exp $

Autoconf is gone now so the old configure patch to add
--enable-tor-browser-data-in-home-dir will never fly.  Hard-code it on
for now on OpenBSD and try to get something similar done under the new
Pyton config regime (encouraged by tbb devs on IRC).  c.f.
https://trac.torproject.org/projects/tor/ticket/20557
Index: xpcom/io/TorFileUtils.cpp
--- xpcom/io/TorFileUtils.cpp.orig
+++ xpcom/io/TorFileUtils.cpp
@@ -11,6 +11,10 @@
 #include "nsILocalFileMac.h"
 #endif
 
+#ifdef __OpenBSD__
+# define TOR_BROWSER_DATA_IN_HOME_DIR 1
+#endif
+
 static nsresult GetAppRootDir(nsIFile *aExeFile, nsIFile** aFile);
 
 //-----------------------------------------------------------------------------
@@ -20,7 +24,17 @@ TorBrowser_GetUserDataDir(nsIFile *aExeFile, nsIFile**
   NS_ENSURE_ARG_POINTER(aFile);
   nsCOMPtr<nsIFile> tbDataDir;
 
-#ifdef TOR_BROWSER_DATA_OUTSIDE_APP_DIR
+#if defined(TOR_BROWSER_DATA_IN_HOME_DIR)
+  const char *homeDir = getenv("HOME");
+  if (!homeDir || !*homeDir)
+    return NS_ERROR_FAILURE;
+  nsresult rv = NS_NewNativeLocalFile(nsDependentCString(homeDir), true,
+                                      getter_AddRefs(tbDataDir));
+  NS_ENSURE_SUCCESS(rv, rv);
+  nsAutoCString leafSubdir(NS_LITERAL_CSTRING("TorBrowser-Data"));
+  rv = tbDataDir->AppendNative(leafSubdir);
+  NS_ENSURE_SUCCESS(rv, rv);
+#elif defined(TOR_BROWSER_DATA_OUTSIDE_APP_DIR)
   nsAutoCString tbDataLeafName(NS_LITERAL_CSTRING("TorBrowser-Data"));
   nsCOMPtr<nsIFile> appRootDir;
   nsresult rv = GetAppRootDir(aExeFile, getter_AddRefs(appRootDir));
