diff --git a/src/include/66/environ.h b/src/include/66/environ.h
index bb0739a7747e9139990849fafc08885dc751c57a..2a56a9435cce867ca4ea3a6c56b821ed7ef85ad3 100644
--- a/src/include/66/environ.h
+++ b/src/include/66/environ.h
@@ -28,6 +28,7 @@ extern int env_make_symlink(resolve_service_t *res) ;
 extern int env_compute(stralloc *result, resolve_service_t *res) ;
 extern int env_clean_with_comment(stralloc *sa) ;
 extern int env_prepare_for_write(stralloc *dst, stralloc *contents, resolve_service_t *res) ;
+extern int env_get_destination(stralloc *sa, resolve_service_t *res) ;
 
 /** version function */
 extern int env_find_current_version(stralloc *sa,char const *svconf) ;
diff --git a/src/lib66/environ/deps-lib/deps b/src/lib66/environ/deps-lib/deps
index 45660af6f5329067c894f5a1280e179dda7ca0b6..8dc6a9bd1b24d281b65626b39be9682abf3a7f2d 100644
--- a/src/lib66/environ/deps-lib/deps
+++ b/src/lib66/environ/deps-lib/deps
@@ -3,6 +3,7 @@ env_check_version.o
 env_clean_with_comment.o
 env_compute.o
 env_find_current_version.o
+env_get_destination.o
 env_import_version_file.o
 env_make_symlink.o
 env_prepare_for_write.o
diff --git a/src/lib66/environ/env_get_destination.c b/src/lib66/environ/env_get_destination.c
new file mode 100644
index 0000000000000000000000000000000000000000..0614de771981785e449bb5a6d394072b0d73d397
--- /dev/null
+++ b/src/lib66/environ/env_get_destination.c
@@ -0,0 +1,44 @@
+/*
+ * env_resolve_conf.c
+ *
+ * Copyright (c) 2018-2022 Eric Vidal <eric@obarun.org>
+ *
+ * All rights reserved.
+ *
+ * This file is part of Obarun. It is subject to the license terms in
+ * the LICENSE file found in the top-level directory of this
+ * distribution.
+ * This file may not be copied, modified, propagated, or distributed
+ * except according to the terms contained in the LICENSE file./
+ */
+
+#include <string.h>
+
+#include <oblibs/log.h>
+#include <oblibs/string.h>
+
+#include <skalibs/stralloc.h>
+#include <skalibs/djbunix.h>
+
+#include <66/environ.h>
+#include <66/constants.h>
+#include <66/service.h>
+
+int env_get_destination(stralloc *sa, resolve_service_t *res)
+{
+    log_flow() ;
+
+    char *conf = res->sa.s + res->environ.envdir ;
+    size_t conflen = strlen(conf) ;
+    char sym[conflen + SS_SYM_VERSION_LEN + 1] ;
+
+    auto_strings(sym, conf, SS_SYM_VERSION) ;
+
+    if (sareadlink(sa, sym) == -1)
+        log_warnusys_return(LOG_EXIT_ZERO, "read link of: ", sym) ;
+
+    if (!stralloc_0(sa))
+        log_warnusys_return(LOG_EXIT_ZERO, "stralloc") ;
+
+    return 1 ;
+}
diff --git a/src/lib66/environ/env_prepare_for_write.c b/src/lib66/environ/env_prepare_for_write.c
index b688aea9f1b83d1c3667ca247af1cabfd0ead798..b4de56d0a71f6eae3bdbe4652adc817c7872ad76 100644
--- a/src/lib66/environ/env_prepare_for_write.c
+++ b/src/lib66/environ/env_prepare_for_write.c
@@ -30,20 +30,11 @@ int env_prepare_for_write(stralloc *dst, stralloc *contents, resolve_service_t *
 {
     log_flow() ;
 
-    char *conf = res->sa.s + res->environ.envdir ;
-    size_t conflen = strlen(conf) ;
-    char sym[conflen + SS_SYM_VERSION_LEN + 1] ;
-
-    auto_strings(sym, conf, SS_SYM_VERSION) ;
-
     if (!env_compute(contents, res))
         log_warnu_return(LOG_EXIT_ZERO, "compute environment") ;
 
-    if (sareadlink(dst, sym) == -1)
-        log_warnusys_return(LOG_EXIT_ZERO, "read link of: ", sym) ;
-
-    if (!stralloc_0(dst))
-        log_warnusys_return(LOG_EXIT_ZERO, "stralloc") ;
+    if (!env_get_destination(dst, res))
+        log_warnu_return(LOG_EXIT_ZERO, "get directory destination for environment") ;
 
     return 1 ;
 }