ruby-changes:16266
From: wyhaines <ko1@a...>
Date: Wed, 9 Jun 2010 04:19:27 +0900 (JST)
Subject: [ruby-changes:16266] Ruby:r28234 (ruby_1_8_6): lib/pathname.rb: Backport #2110 ; backport of r23093 to handle the scenario where, on filesystems like Windows', paths are compared using casecmp instead of ==.
wyhaines 2010-06-09 04:19:17 +0900 (Wed, 09 Jun 2010) New Revision: 28234 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=28234 Log: lib/pathname.rb: Backport #2110 [ruby-core:25627]; backport of r23093 to handle the scenario where, on filesystems like Windows', paths are compared using casecmp instead of ==. Modified files: branches/ruby_1_8_6/ChangeLog branches/ruby_1_8_6/lib/pathname.rb branches/ruby_1_8_6/version.h Index: ruby_1_8_6/ChangeLog =================================================================== --- ruby_1_8_6/ChangeLog (revision 28233) +++ ruby_1_8_6/ChangeLog (revision 28234) @@ -1,6 +1,10 @@ +Wed Jun 9 02:10:00 Kirk Haines <khaines@r...> + + * lib/pathname.rb: Backport #2110 [ruby-core:25627]; backport of r23093 to handle the scenario where, on filesystems like Windows', paths are compared using casecmp instead of ==. + Wed Jun 9 01:42:00 Kirk Haines <khaines@r...> - * lib/date.rb: Backport #2707 [ruby-core:28011]; backport r27014 to fix problem with Date#>> and very small numbers. + * lib/date.rb: Backport #2707 [ruby-core:28011]; backport r27014 to fix problem with Date#>> and very small numbers. r28233 Wed Jun 9 01:05:00 Kirk Haines <khaines@r...> Index: ruby_1_8_6/version.h =================================================================== --- ruby_1_8_6/version.h (revision 28233) +++ ruby_1_8_6/version.h (revision 28234) @@ -2,7 +2,7 @@ #define RUBY_RELEASE_DATE "2010-06-09" #define RUBY_VERSION_CODE 186 #define RUBY_RELEASE_CODE 20100609 -#define RUBY_PATCHLEVEL 409 +#define RUBY_PATCHLEVEL 410 #define RUBY_VERSION_MAJOR 1 #define RUBY_VERSION_MINOR 8 Index: ruby_1_8_6/lib/pathname.rb =================================================================== --- ruby_1_8_6/lib/pathname.rb (revision 28233) +++ ruby_1_8_6/lib/pathname.rb (revision 28234) @@ -194,6 +194,13 @@ # to_path is implemented so Pathname objects are usable with File.open, etc. TO_PATH = :to_path end + + SAME_PATHS = if File::FNM_SYSCASE + proc {|a, b| a.casecmp(b).zero?} + else + proc {|a, b| a == b} + end + # :startdoc: # @@ -705,12 +712,12 @@ 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 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/