Skip to content

Commit

Permalink
Add OMC_ROOT environment to control where OMC writes its files to
Browse files Browse the repository at this point in the history
  • Loading branch information
jhunkeler committed Mar 7, 2024
1 parent d918d14 commit 6a1ab04
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/deliverable.c
Original file line number Diff line number Diff line change
Expand Up @@ -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");

Expand Down

0 comments on commit 6a1ab04

Please sign in to comment.