Module: Device::Library::Windows
- Defined in:
- lib/device/library/windows.rb
Instance Method Summary collapse
Instance Method Details
#get_device_root_dir(volume_name) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/device/library/windows.rb', line 11 def get_device_root_dir(volume_name) @@FileSystemObject ||= WIN32OLE.new("Scripting.FileSystemObject") get_drives.each do |drive_letter| drive_info = @@FileSystemObject.GetDrive(drive_letter) vol = drive_info.VolumeName rescue "" if vol.downcase == volume_name.downcase return File.(drive_letter) end end nil end |
#get_drives ⇒ Object
23 24 25 26 27 28 29 30 31 32 |
# File 'lib/device/library/windows.rb', line 23 def get_drives result = [] bits = WinAPI.GetLogicalDrives 26.times do |i| if bits & (1 << i) != 0 result << "#{(65 + i).chr}:\\" end end result end |