diff options
author | hsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-03-28 10:03:03 +0000 |
---|---|---|
committer | hsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-03-28 10:03:03 +0000 |
commit | 10b96900b90914b0cc1dba36f9736c038db2859d (patch) | |
tree | 1028502d845fa2e7ca07b27a7ddc97363b4c20df /lib/tmpdir.rb | |
parent | bd5661a3cbb38a8c3a3ea10cd76c88bbef7871b8 (diff) |
Ignore file separator from tmpfile/tmpdir name.
From: SHIBATA Hiroshi <[email protected]>
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62990 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/tmpdir.rb')
-rw-r--r-- | lib/tmpdir.rb | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/tmpdir.rb b/lib/tmpdir.rb index e30004c0bb..7c0ce3a7f0 100644 --- a/lib/tmpdir.rb +++ b/lib/tmpdir.rb @@ -116,8 +116,10 @@ class Dir prefix, suffix = basename prefix = (String.try_convert(prefix) or raise ArgumentError, "unexpected prefix: #{prefix.inspect}") + prefix = prefix.delete("#{File::SEPARATOR}#{File::ALT_SEPARATOR}") suffix &&= (String.try_convert(suffix) or raise ArgumentError, "unexpected suffix: #{suffix.inspect}") + suffix &&= suffix.delete("#{File::SEPARATOR}#{File::ALT_SEPARATOR}") begin t = Time.now.strftime("%Y%m%d") path = "#{prefix}#{t}-#{$$}-#{rand(0x100000000).to_s(36)}"\ |