[前][次][番号順一覧][スレッド一覧]

ruby-changes:11468

From: nobu <ko1@a...>
Date: Sun, 29 Mar 2009 08:59:43 +0900 (JST)
Subject: [ruby-changes:11468] Ruby:r23093 (trunk): * lib/pathname.rb (Pathname#relative_path_from): compares path

nobu	2009-03-29 08:59:28 +0900 (Sun, 29 Mar 2009)

  New Revision: 23093

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=23093

  Log:
    * lib/pathname.rb (Pathname#relative_path_from): compares path
      components according to system default case-sensitiveness.
      [ruby-core:22829]

  Modified files:
    trunk/ChangeLog
    trunk/lib/pathname.rb
    trunk/version.h

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 23092)
+++ ChangeLog	(revision 23093)
@@ -1,3 +1,9 @@
+Sun Mar 29 08:59:26 2009  Nobuyoshi Nakada  <nobu@r...>
+
+	* 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  <nobu@r...>
 
 	* common.mk (ruby.imp): all symbols in static library need to be
Index: lib/pathname.rb
===================================================================
--- lib/pathname.rb	(revision 23092)
+++ lib/pathname.rb	(revision 23093)
@@ -197,6 +197,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:
 
   #
@@ -786,12 +793,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
Index: version.h
===================================================================
--- version.h	(revision 23092)
+++ version.h	(revision 23093)
@@ -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[];

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]