[REBOL] Re: REBOL_HOME
From: mumpsoid::gmx::com at: 31-Mar-2009 5:42
On Mon, 30 Mar 2009, Maxim Olivier-Adlhoch wrote:
> 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
I don't yet understand REBOL enough or it's inner workings to "see"
how the above code would point the interpreter to where I want REBOL's
script home
to be.
--
Duke Normandin
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing in e-mail?