mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
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 ==.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8_6@28234 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
44c8d6c4db
commit
af6593ba0d
3 changed files with 15 additions and 4 deletions
|
|
@ -1,6 +1,10 @@
|
||||||
|
Wed Jun 9 02:10:00 Kirk Haines <khaines@ruby-lang.org>
|
||||||
|
|
||||||
|
* 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@ruby-lang.org>
|
Wed Jun 9 01:42:00 Kirk Haines <khaines@ruby-lang.org>
|
||||||
|
|
||||||
* 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@ruby-lang.org>
|
Wed Jun 9 01:05:00 Kirk Haines <khaines@ruby-lang.org>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -194,6 +194,13 @@ class Pathname
|
||||||
# to_path is implemented so Pathname objects are usable with File.open, etc.
|
# to_path is implemented so Pathname objects are usable with File.open, etc.
|
||||||
TO_PATH = :to_path
|
TO_PATH = :to_path
|
||||||
end
|
end
|
||||||
|
|
||||||
|
SAME_PATHS = if File::FNM_SYSCASE
|
||||||
|
proc {|a, b| a.casecmp(b).zero?}
|
||||||
|
else
|
||||||
|
proc {|a, b| a == b}
|
||||||
|
end
|
||||||
|
|
||||||
# :startdoc:
|
# :startdoc:
|
||||||
|
|
||||||
#
|
#
|
||||||
|
|
@ -705,12 +712,12 @@ class Pathname
|
||||||
base_prefix, basename = r
|
base_prefix, basename = r
|
||||||
base_names.unshift basename if basename != '.'
|
base_names.unshift basename if basename != '.'
|
||||||
end
|
end
|
||||||
if dest_prefix != base_prefix
|
unless SAME_PATHS[dest_prefix, base_prefix]
|
||||||
raise ArgumentError, "different prefix: #{dest_prefix.inspect} and #{base_directory.inspect}"
|
raise ArgumentError, "different prefix: #{dest_prefix.inspect} and #{base_directory.inspect}"
|
||||||
end
|
end
|
||||||
while !dest_names.empty? &&
|
while !dest_names.empty? &&
|
||||||
!base_names.empty? &&
|
!base_names.empty? &&
|
||||||
dest_names.first == base_names.first
|
SAME_PATHS[dest_names.first, base_names.first]
|
||||||
dest_names.shift
|
dest_names.shift
|
||||||
base_names.shift
|
base_names.shift
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
#define RUBY_RELEASE_DATE "2010-06-09"
|
#define RUBY_RELEASE_DATE "2010-06-09"
|
||||||
#define RUBY_VERSION_CODE 186
|
#define RUBY_VERSION_CODE 186
|
||||||
#define RUBY_RELEASE_CODE 20100609
|
#define RUBY_RELEASE_CODE 20100609
|
||||||
#define RUBY_PATCHLEVEL 409
|
#define RUBY_PATCHLEVEL 410
|
||||||
|
|
||||||
#define RUBY_VERSION_MAJOR 1
|
#define RUBY_VERSION_MAJOR 1
|
||||||
#define RUBY_VERSION_MINOR 8
|
#define RUBY_VERSION_MINOR 8
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue