summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorshyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-11-23 08:21:08 +0000
committershyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-11-23 08:21:08 +0000
commit44fcc21eb6d784359427d63030b5014ce4bbf911 (patch)
tree583f0ac823fbe432e4a35c56db81c0948269802c /lib
parent16b5c5e928b85c387a79f5ce846f68b6db98bd9d (diff)
merge revision(s) 29333:
* lib/pathname.rb (relative_path_from): backport r23093 and r25440 from ruby_1_9_2. [ruby-core:32415] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@29333 b2dd03c8-39d4-4d8f-98ff-823fe69b080e Signed-off-by: URABE, Shyouhei <shyouhei@ruby-lang.org> git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8_7@29884 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib')
-rw-r--r--lib/pathname.rb11
1 files changed, 9 insertions, 2 deletions
diff --git a/lib/pathname.rb b/lib/pathname.rb
index 84196355a6..f2791b9823 100644
--- a/lib/pathname.rb
+++ b/lib/pathname.rb
@@ -194,6 +194,13 @@ class Pathname
# to_path is implemented so Pathname objects are usable with File.open, etc.
TO_PATH = :to_path
end
+
+ SAME_PATHS = if File::FNM_SYSCASE.nonzero?
+ proc {|a, b| a.casecmp(b).zero?}
+ else
+ proc {|a, b| a == b}
+ end
+
# :startdoc:
#
@@ -719,12 +726,12 @@ class Pathname
base_prefix, basename = r
base_names.unshift basename if basename != '.'
end
- if dest_prefix != base_prefix
+ unless SAME_PATHS[dest_prefix, base_prefix]
raise ArgumentError, "different prefix: #{dest_prefix.inspect} and #{base_directory.inspect}"
end
while !dest_names.empty? &&
!base_names.empty? &&
- dest_names.first == base_names.first
+ SAME_PATHS[dest_names.first, base_names.first]
dest_names.shift
base_names.shift
end