зеркало из https://github.com/github/ruby.git
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. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37692 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
7bd638b7a4
Коммит
25058a58a2
|
@ -1,3 +1,10 @@
|
|||
Sat Nov 17 07:35:15 2012 Luis Lavena <luislavena@gmail.com>
|
||||
|
||||
* 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@ruby-lang.org>
|
||||
|
||||
* marshal.c (w_object): add flonum to arg->data to keep reference index
|
||||
|
|
|
@ -662,6 +662,11 @@ class TestFileExhaustive < Test::Unit::TestCase
|
|||
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))
|
||||
|
|
|
@ -276,6 +276,11 @@ replace_to_long_name(wchar_t **wfullpath, size_t size, int heap)
|
|||
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'.') {
|
||||
|
|
Загрузка…
Ссылка в новой задаче