diff options
author | Jay Mundrawala <jdmundrawala@gmail.com> | 2015-08-26 14:52:31 -0700 |
---|---|---|
committer | Kartik Null Cating-Subramanian <ksubramanian@chef.io> | 2015-08-27 11:54:52 -0400 |
commit | 763d15a07d76c21cba72527a6134ecf353909f91 (patch) | |
tree | 30c13ed39dc8bfe8d6346911e55c9a6b43fb312d /lib/chef/win32/file.rb | |
parent | 5a863dc4331799b5876edcf5fdc31666f47888d6 (diff) | |
download | chef-763d15a07d76c21cba72527a6134ecf353909f91.tar.gz |
Use ffi for GetVolumeNameForVolumeMountPoint
Diffstat (limited to 'lib/chef/win32/file.rb')
-rw-r--r-- | lib/chef/win32/file.rb | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/chef/win32/file.rb b/lib/chef/win32/file.rb index f62f9333f5..57347643fc 100644 --- a/lib/chef/win32/file.rb +++ b/lib/chef/win32/file.rb @@ -192,6 +192,13 @@ class Chef end end + def self.get_volume_name_for_volume_mount_point(mount_point) + buffer = FFI::MemoryPointer.new(2, 128) + unless GetVolumeNameForVolumeMountPointW(wstring(mount_point), buffer, buffer.size/buffer.type_size) + Chef::ReservedNames::Win32::Error.raise! + end + buffer.read_wstring + end # ::File compat class << self |