Wednesday, October 24, 2012

Re: How to check for $ProgramFiles(x86) ?

On 2012-10-24, Timothy Madden wrote:
> Hello
>
> I am trying to see if the current system is 32-bit or 64-bit Windows.
> On 64-bit Windows the environment variable $ProgramFiles(x86) is
> known to exits, but Vim will just check for $ProgramFiles and the
> appendthe '(x86)' part. Is there a way to check if the environment
> variable $ProgramFiles(x86) exists in the current environment ?
>
> I tried both expand('$ProgramFiles(x86)') and
> exists('$ProgramFiles(x86)'), both of them check the '$ProgamFiles'
> part only.

I think the following or a variation should do it. I was only able
to test it on names without parentheses as I didn't see any variable
names with them in my environment.

split(system('set ProgramFiles(x86)', '=')[1]

gets the value and

system('set ProgramFiles(x86)') =~ 'not defined'

will evaluate to true if the variable is not defined.

Regards,
Gary

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

No comments: