ruby-changes:25635
From: luislavena <ko1@a...>
Date: Sat, 17 Nov 2012 07:55:28 +0900 (JST)
Subject: [ruby-changes:25635] luislavena:r37692 (trunk): skip long name conversion if last character is a wildcard one
luislavena 2012-11-17 07:43:22 +0900 (Sat, 17 Nov 2012) New Revision: 37692 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=37692 Log: skip long name conversion if last character is a wildcard one * win32/file.c (replace_to_long_name): skip automatic path expansion when wildcard character is used. [ruby-core:49451] [Bug #7374] * test/ruby/test_file_exhaustive.rb: add a test for above. Modified files: trunk/ChangeLog trunk/test/ruby/test_file_exhaustive.rb trunk/win32/file.c Index: ChangeLog =================================================================== --- ChangeLog (revision 37691) +++ ChangeLog (revision 37692) @@ -1,3 +1,10 @@ +Sat Nov 17 07:35:15 2012 Luis Lavena <luislavena@g...> + + * win32/file.c (replace_to_long_name): skip automatic path expansion + when wildcard character is used. [ruby-core:49451] [Bug #7374] + + * test/ruby/test_file_exhaustive.rb: add a test for above. + Sat Nov 17 00:50:23 2012 CHIKANAGA Tomoyuki <nagachika@r...> * marshal.c (w_object): add flonum to arg->data to keep reference index Index: win32/file.c =================================================================== --- win32/file.c (revision 37691) +++ win32/file.c (revision 37692) @@ -276,6 +276,11 @@ return size; } + /* skip long name conversion if last character is a wildcard */ + if (pos[size - 1] == L'*') { + return size; + } + pos = *wfullpath + size - 1; while (!IS_DIR_SEPARATOR_P(*pos) && pos != *wfullpath) { if (!extension_len && *pos == L'.') { Index: test/ruby/test_file_exhaustive.rb =================================================================== --- test/ruby/test_file_exhaustive.rb (revision 37691) +++ test/ruby/test_file_exhaustive.rb (revision 37692) @@ -662,6 +662,11 @@ assert_equal("#{DRIVE}/dir", File.expand_path("#{DRIVE}/./dir")) end + def test_expand_path_does_not_expand_wildcard + 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 str = "./a/b/../c" assert_equal("#{Dir.pwd}/a/c", File.expand_path(str, Dir.pwd)) -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/