Installation script's target directory

Hugh Sasse hgs at dmu.ac.uk
Tue Aug 9 07:34:41 EDT 2005


On Tue, 9 Aug 2005, Doug Kearns wrote:

> On Fri, Jul 29, 2005 at 01:02:06AM +1000, Doug Kearns wrote:
>
> <snip>
>
>> My intent would be to offer $VIM/vimfiles and $HOME/.vim as the default
>> installation directories. I guess we'll have to parse "env vim
>> --version" to determine $VIM. What's the best way on Windows?
>
> Because I'm 'flying blind', without access to a Windows box anytime
> soon, could someone please do me a favour and see if something like this
> returns $VIM?
>
> require 'win32/registry'
> dirs = []
> path = ''
> Win32::Registry::HKEY_LOCAL_MACHINE.open('SOFTWARE\Vim\Gvim') do |reg|
>  path = reg['path', Win32::Registry::REG_SZ]
> end
> unless path.empty?
>  system_dir = path.sub(/\\vim\d\d\\gvim.exe/, '')
>  dirs << system_dir + '/vimfiles'
> end
>
> <snip>

Windows98 I get 
rb(main):001:0> require 'win32/registry'
=> true
irb(main):002:0> dirs = []
=> []
irb(main):003:0> path = ''
=> ""
irb(main):004:0> Win32::Registry::HKEY_LOCAL_MACHINE.open('SOFTWARE\Vim\Gvim') d
o |reg|
irb(main):005:1*   path = reg['path', Win32::Registry::REG_SZ]
irb(main):006:1> end
=> "C:\\VIM\\VIM63\\gvim.exe"
irb(main):007:0> unless path.empty?
irb(main):008:1>   system_dir = path.sub(/\\vim\d\d\\gvim.exe/, '')
irb(main):009:1>   dirs << system_dir + '/vimfiles'
irb(main):010:1> end
=> ["C:\\VIM\\VIM63\\gvim.exe/vimfiles"]
irb(main):011:0> dirs
=> ["C:\\VIM\\VIM63\\gvim.exe/vimfiles"]
irb(main):012:0>

but in my vim I get
C:\vim 
from echo $VIM

And that's with

irb(main):012:0> puts RUBY_VERSION
1.8.2
=> nil
irb(main):013:0>

or

C:\WINDOWS>ruby --version
ruby 1.8.2 (2004-12-25) [i386-mswin32]

C:\WINDOWS>


>
> Thanks,
> Doug
>
         HTH
         Hugh



More information about the vim-ruby-devel mailing list