]> gitweb.factorcode.org Git - factor.git/blobdiff - basis/environment/environment.factor
basis: use lint.vocabs tool to trim using lists
[factor.git] / basis / environment / environment.factor
index 92859349b74485450691e5792b995e50247d0090..ee3071acbea9a67be0690c5b5d9c84a605c85e58 100644 (file)
@@ -1,7 +1,7 @@
 ! Copyright (C) 2008 Doug Coleman.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: assocs combinators init kernel sequences splitting
-system vocabs vocabs.loader ;
+USING: assocs combinators continuations kernel sequences
+splitting system vocabs vocabs.loader ;
 IN: environment
 
 HOOK: os-env os ( key -- value )
@@ -25,15 +25,18 @@ HOOK: set-os-envs-pointer os ( malloc -- )
 : set-os-envs ( assoc -- )
     [ "=" glue ] { } assoc>map (set-os-envs) ;
 
+: with-os-env ( value key quot -- )
+    over [ [ [ set-os-env ] 2curry ] [ compose ] bi* ] dip
+    [ os-env ] keep [ set-os-env ] 2curry finally ; inline
+
 {
     { [ os unix? ] [ "environment.unix" require ] }
     { [ os windows? ] [ "environment.windows" require ] }
 } cond
 
-[
-    "FACTOR_ROOTS" os-env
-    [
+STARTUP-HOOK: [
+    "FACTOR_ROOTS" os-env [
         os windows? ";" ":" ? split
         [ add-vocab-root ] each
-    ] when*    
-] "environment" add-startup-hook
+    ] when*
+]