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

ruby-changes:25643

From: luislavena <ko1@a...>
Date: Sat, 17 Nov 2012 21:46:27 +0900 (JST)
Subject: [ruby-changes:25643] luislavena:r37700 (trunk): Skip path expansion for all wildcard characters

luislavena	2012-11-17 21:46:17 +0900 (Sat, 17 Nov 2012)

  New Revision: 37700

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

  Log:
    Skip path expansion for all wildcard characters
    
    * win32/file.c (replace_to_long_name): skip expansion for all wildcard
      characters.
      [ruby-core:49451] [Bug #7374]
    
    * test/ruby/test_file_exhaustive.rb: add more assertions to test.

  Modified files:
    trunk/ChangeLog
    trunk/test/ruby/test_file_exhaustive.rb
    trunk/win32/file.c

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 37699)
+++ ChangeLog	(revision 37700)
@@ -1,3 +1,11 @@
+Sat Nov 17 21:45:12  Luis Lavena  <luislavena@g...>
+
+	* win32/file.c (replace_to_long_name): skip expansion for all wildcard
+	  characters.
+	  [ruby-core:49451] [Bug #7374]
+
+	* test/ruby/test_file_exhaustive.rb: add more assertions to test.
+
 Sat Nov 17 12:14:50 2012  Aaron Patterson <aaron@t...>
 
 	* ext/psych/lib/psych/visitors/yaml_tree.rb: use literal YAML style
Index: win32/file.c
===================================================================
--- win32/file.c	(revision 37699)
+++ win32/file.c	(revision 37700)
@@ -276,8 +276,8 @@
 	return size;
     }
 
-    /* skip long name conversion if last character is a wildcard */
-    if (pos[size - 1] == L'*') {
+    /* skip long name conversion if path contains wildcard characters */
+    if (!wcspbrk(pos, "*?")) {
 	return size;
     }
 
Index: test/ruby/test_file_exhaustive.rb
===================================================================
--- test/ruby/test_file_exhaustive.rb	(revision 37699)
+++ test/ruby/test_file_exhaustive.rb	(revision 37700)
@@ -662,9 +662,11 @@
     assert_equal("#{DRIVE}/dir", File.expand_path("#{DRIVE}/./dir"))
   end
 
-  def test_expand_path_does_not_expand_wildcard
+  def test_expand_path_does_not_expand_wildcards
     assert_equal("#{DRIVE}/*", File.expand_path("./*", "#{DRIVE}/"))
     assert_equal("#{Dir.pwd}/*", File.expand_path("./*", Dir.pwd))
+    assert_equal("#{DRIVE}/?", File.expand_path("./?", "#{DRIVE}/"))
+    assert_equal("#{Dir.pwd}/?", File.expand_path("./?", Dir.pwd))
   end if DRIVE
 
   def test_expand_path_does_not_modify_the_string_argument

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

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