On Wed, Oct 24, 2012 at 2:50 PM, Ben Fritz <fritzophrenic@gmail.com> wrote:
> On Wednesday, October 24, 2012 4:25:41 PM UTC-5, Gary Johnson wrote:
>>
>> 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.
>>
>
> Not quite. You get hit by Windows *#$&#ing command-line quoting.
>
> This works for me:
>
> :echo system('set PROGRAMFILES^(x86^)')
In the past, I've solved very similar problems with batch files [1]
and Bash scripts [2].
The parentheses in the environment variable name are asinine.
[1] http://weblogs.asp.net/george_v_reilly/archive/2009/09/11/launching-32-bit-applications-from-batchfiles-on-win64.aspx
@setlocal
@set _pf=%ProgramFiles%
@if not "[%ProgramFiles(x86)%]"=="[]" set _pf=%ProgramFiles(x86)%
@start "" /b "%_pf%\SourceGear\DiffMerge\DiffMerge.exe" %*
[2] http://thread.gmane.org/gmane.comp.gnu.mingw.user/31262/focus=31273
#!/bin/sh
pf=`env | sed -n s,'^PROGRAMFILES(X86)=',,p`
if [ -z "$pf" ]; then pf="$PROGRAMFILES"; fi
"$pf/SourceGear/DiffMerge/DiffMerge.exe" $*
--
/George V. Reilly george@reilly.org Twitter: @georgevreilly
http://www.georgevreilly.com/blog http://blogs.cozi.com/tech
--
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
Wednesday, October 24, 2012
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment