From 057732c445b30ea39fb169795ce8be2824e8faeb Mon Sep 17 00:00:00 2001 From: Dan Ballard Date: Wed, 7 Jul 2021 16:12:20 -0700 Subject: [PATCH] Add support for CWTCH_DIR env var --- LIBCWTCH-GO.version | 2 +- README.md | 4 +++- lib/cwtch/ffi.dart | 7 ++++--- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/LIBCWTCH-GO.version b/LIBCWTCH-GO.version index 080fef9f..534536d7 100644 --- a/LIBCWTCH-GO.version +++ b/LIBCWTCH-GO.version @@ -1 +1 @@ -v1.0.0-25-g801a805-2021-07-07-16-10 \ No newline at end of file +v1.0.0-27-g4d218df-2021-07-07-23-27 diff --git a/README.md b/README.md index 25c80b52..f95318aa 100644 --- a/README.md +++ b/README.md @@ -11,10 +11,12 @@ This README covers build instructions, for information on Cwtch itself please go - Linux: Available from [https://cwtch.im/download/](https://cwtch.im/download/) as a .tar.gz - `install.home.sh` installs the app into your home directory - `install.sys.sh` as root to install system wide + - or run out of the unziped directory ## Running -Cwtch logging is controlable with the following environment variables: +Cwtch processes the following environment variables: +- `CWTCH_HOME=` overrides the default storage path of `~/.cwtch` with what ever you choose - `LOG_FILE=` will reroute all of libcwtch-go's logging to the specified file instead of the console - `LOG_LEVEL=debug` will set the log level to debug instead of info diff --git a/lib/cwtch/ffi.dart b/lib/cwtch/ffi.dart index a1b4bda7..f0957f08 100644 --- a/lib/cwtch/ffi.dart +++ b/lib/cwtch/ffi.dart @@ -89,7 +89,7 @@ class CwtchFfi implements Cwtch { String bundledTor = ""; Map envVars = Platform.environment; if (Platform.isLinux) { - home = (envVars['HOME'])!; + home = envVars['HOME']!; if (await File("linux/tor").exists()) { bundledTor = "linux/tor"; } else if (await File("lib/tor").exists()) { @@ -102,10 +102,11 @@ class CwtchFfi implements Cwtch { bundledTor = "tor"; } } else if (Platform.isWindows) { - home = (envVars['UserProfile'])!; + home = envVars['UserProfile']!; bundledTor = "Tor\\Tor\\tor.exe"; } - var cwtchDir = path.join(home, ".cwtch"); + + var cwtchDir = envVars['CWTCH_HOME'] ?? path.join(home, ".cwtch"); if (EnvironmentConfig.BUILD_VER == dev_version) { cwtchDir = path.join(cwtchDir, "dev"); }