Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

[REBOL] Re: REBOL_HOME

From: moliad::gmail at: 30-Mar-2009 15:06

Hi all, you can use the library system to get the env. directly... since its now free as of v2.7.6 its not a big deal. but you still need to source the config (user.r) script manually then. -------------------------------------------------------------- ;- libc libc*: context [ libc: make library! switch system/version/4 [ 2 [%libc.dylib] ; OSX 3 [%msvcrt.dll] ; Windows 4 [%libc.so] ; Linux 7 [%libc.so] ; FreeBSD 8 [%libc.so] ; NetBSD 9 [%libc.so] ; OpenBSD 10 [%libc.so] ; Solaris ] getenv: make routine! [ "Get an environment variable." in-string [string!] "Name of an environment variable" return: [string!] ] libc "getenv" ] ;- getenv getenv: func [ "REBOL friendly getenv function" varname [word! string!] ][ varname: to-string varname if find varname " " [ to-error "os.getenv() varname may not contain spaces." ] return libc*/getenv as-string varname ] home-path: probe get-env 'HOME do join dirize to-rebol-file home-path %rebol-user-config.r ------------------------------------------------------- HTH! -MAx