Method: PSWindows::File#tmpdir

Defined in:
lib/beaker/host/pswindows/file.rb

#tmpdir(name = '') ⇒ Object



9
10
11
12
13
14
15
# File 'lib/beaker/host/pswindows/file.rb', line 9

def tmpdir(name = '')
  tmp_path = exec(powershell('[System.IO.Path]::GetTempPath()')).stdout.chomp

  name = exec(powershell('[System.IO.Path]::GetRandomFileName()')).stdout.chomp if name == ''
  exec(powershell("New-Item -Path '#{tmp_path}' -Force -Name '#{name}' -ItemType 'directory'"))
  File.join(tmp_path, name)
end