Sha256: 0836f88c4d6f16e9d4d45cb58c5607485c1dd4ee3ee5f8c584ebebeef5bcd22b

Contents?: true

Size: 889 Bytes

Versions: 14

Compression:

Stored size: 889 Bytes

Contents

class Dir
  # @private
  def self.mktmpdir(prefix_suffix=nil, tmpdir=nil)
    case prefix_suffix
    when nil
      prefix = "d"
      suffix = ""
    when String
      prefix = prefix_suffix
      suffix = ""
    when Array
      prefix = prefix_suffix[0]
      suffix = prefix_suffix[1]
    else
      raise ArgumentError, "unexpected prefix_suffix: #{prefix_suffix.inspect}"
    end
    tmpdir ||= Dir.tmpdir
    t = Time.now.strftime("%Y%m%d")
    n = nil
    begin
      path = "#{tmpdir}/#{prefix}#{t}-#{$$}-#{rand(0x100000000).to_s(36)}"
      path << "-#{n}" if n
      path << suffix
      Dir.mkdir(path, 0700)
    rescue Errno::EEXIST
      n ||= 0
      n += 1
      retry
    end

    if block_given?
      begin
        yield path
      ensure
        FileUtils.remove_entry_secure path
      end
    else
      path
    end
  end unless respond_to? :mktmpdir # > 1.8.7
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
selenium-webdriver-0.1.1 lib/selenium/webdriver/common/core_ext/dir.rb
selenium-webdriver-0.1.0 lib/selenium/webdriver/common/core_ext/dir.rb
selenium-webdriver-0.0.29 lib/selenium/webdriver/common/core_ext/dir.rb
selenium-webdriver-0.0.28 lib/selenium/webdriver/core_ext/dir.rb
selenium-webdriver-0.0.27 lib/selenium/webdriver/core_ext/dir.rb
selenium-webdriver-0.0.26 lib/selenium/webdriver/core_ext/dir.rb
selenium-webdriver-0.0.25 lib/selenium/webdriver/core_ext/dir.rb
selenium-webdriver-0.0.24 common/src/rb/lib/selenium/webdriver/core_ext/dir.rb
selenium-webdriver-0.0.23 common/src/rb/lib/selenium/webdriver/core_ext/dir.rb
selenium-webdriver-0.0.22 common/src/rb/lib/selenium/webdriver/core_ext/dir.rb
selenium-webdriver-0.0.21 common/src/rb/lib/selenium/webdriver/core_ext/dir.rb
selenium-webdriver-0.0.20 common/src/rb/lib/selenium/webdriver/core_ext/dir.rb
selenium-webdriver-0.0.19 common/src/rb/lib/selenium/webdriver/core_ext/dir.rb
selenium-webdriver-0.0.18 common/src/rb/lib/selenium/webdriver/core_ext/dir.rb