Installation script's target directory

Doug Kearns dougkearns at gmail.com
Tue Aug 9 06:43:08 EDT 2005


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>
 
Thanks,
Doug


More information about the vim-ruby-devel mailing list