aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoseph Hunkeler <jhunkeler@gmail.com>2024-03-07 10:08:13 -0500
committerJoseph Hunkeler <jhunkeler@gmail.com>2024-03-07 10:08:13 -0500
commit6a1ab047bfb7abe6bae70cab79143c34b5a9b2e1 (patch)
tree5ace83341103cdd6b8b22a987dd8561b6e12fdce
parentd918d14bd6836777d822da368bb16ef0789c2e9c (diff)
downloadstasis-6a1ab047bfb7abe6bae70cab79143c34b5a9b2e1.tar.gz
Add OMC_ROOT environment to control where OMC writes its files to
-rw-r--r--src/deliverable.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/deliverable.c b/src/deliverable.c
index 5b0d3ff..5f154b5 100644
--- a/src/deliverable.c
+++ b/src/deliverable.c
@@ -206,7 +206,17 @@ void delivery_free(struct Delivery *ctx) {
}
void delivery_init_dirs(struct Delivery *ctx) {
- path_store(&ctx->storage.root, PATH_MAX, "omc", "");
+ char *rootdir = getenv("OMC_ROOT");
+ if (rootdir) {
+ if (isempty(rootdir)) {
+ fprintf(stderr, "OMC_ROOT is set, but empty. Please assign a file system path to this environment variable.\n");
+ exit(1);
+ }
+ path_store(&ctx->storage.root, PATH_MAX, rootdir, "");
+ } else {
+ // use "omc" in current working directory
+ path_store(&ctx->storage.root, PATH_MAX, "omc", "");
+ }
path_store(&ctx->storage.tools_dir, PATH_MAX, ctx->storage.root, "tools");
path_store(&ctx->storage.tmpdir, PATH_MAX, ctx->storage.root, "tmp");