From 896db7d62512ec9baa5b5f7b0644e22d3c619064 Mon Sep 17 00:00:00 2001 From: nobu Date: Sat, 28 Mar 2009 23:59:28 +0000 Subject: [PATCH] * lib/pathname.rb (Pathname#relative_path_from): compares path components according to system default case-sensitiveness. [ruby-core:22829] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23093 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 6 ++++++ lib/pathname.rb | 11 +++++++++-- version.h | 4 ++-- 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 1eea0c3a79..0e44579c40 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +Sun Mar 29 08:59:26 2009 Nobuyoshi Nakada + + * lib/pathname.rb (Pathname#relative_path_from): compares path + components according to system default case-sensitiveness. + [ruby-core:22829] + Sat Mar 28 11:10:32 2009 Nobuyoshi Nakada * common.mk (ruby.imp): all symbols in static library need to be diff --git a/lib/pathname.rb b/lib/pathname.rb index 75faaef8b2..7b7ed374ea 100644 --- a/lib/pathname.rb +++ b/lib/pathname.rb @@ -197,6 +197,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 + proc {|a, b| a.casecmp(b).zero?} + else + proc {|a, b| a == b} + end + # :startdoc: # @@ -786,12 +793,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 diff --git a/version.h b/version.h index fbda321043..4598af97ba 100644 --- a/version.h +++ b/version.h @@ -1,5 +1,5 @@ #define RUBY_VERSION "1.9.2" -#define RUBY_RELEASE_DATE "2009-03-28" +#define RUBY_RELEASE_DATE "2009-03-29" #define RUBY_PATCHLEVEL -1 #define RUBY_BRANCH_NAME "trunk" @@ -8,7 +8,7 @@ #define RUBY_VERSION_TEENY 1 #define RUBY_RELEASE_YEAR 2009 #define RUBY_RELEASE_MONTH 3 -#define RUBY_RELEASE_DAY 28 +#define RUBY_RELEASE_DAY 29 #ifdef RUBY_EXTERN RUBY_EXTERN const char ruby_version[];