PATCH: default installation directories

Hugh Sasse hgs at dmu.ac.uk
Tue Aug 16 07:25:42 EDT 2005


Oh, I see those patches aren't in the CVS yet.  OK.  Reading through
I noticed a couple of things that may cause problems, so I've added
comments and express them in the form of a patch for convenience.

I think my mods to _same_contents *may* cover macs as well now, 
which I think used \r as a line ending.  Probably not MacOSX.

         HTH
         Hugh

--- vim-ruby/bin/vim-ruby-install.rb.orig	2005-08-16 11:39:51.236954000 +0100
+++ vim-ruby/bin/vim-ruby-install.rb	2005-08-16 12:09:37.698997000 +0100
@@ -119,6 +119,8 @@
    def _ensure_directory_exists(path)
      dir = path.dirname
      unless dir.directory?
+      # <XXX> FileUtils.mkdir_p already checks if it exists and is a
+      # directory.  What if it exists as a file? (HGS)</XXX>
        mkpath(dir)
      end
    end
@@ -220,6 +222,9 @@
        dir
      else
        Dir.glob("#{dir}/vim*").select { |d| d =~ /vim\d+/ }.sort.last
+      # <XXX> I think this may fail at vim version 10 or if vim
+      # 6.22 were replaced by Vim 7.  Not sure of a good fix at this
+      # time (HGS)</XXX>
      end
    end

@@ -279,8 +284,9 @@

      # Test two files for equality of contents, ignoring line endings.
    def _same_contents?(p1, p2)
-    contents1 = p1.read.split("\n").map { |line| line.chomp }
-    contents2 = p2.read.split("\n").map { |line| line.chomp }
+    ending = /[\r\n]+/
+    contents1 = p1.read.split(ending).map { |line| line.chomp }
+    contents2 = p2.read.split(ending).map { |line| line.chomp }
      contents1 == contents2
    end



More information about the vim-ruby-devel mailing list