Sha256: af3b1d74f2cb5e4ebe6d937678bec03894335ebca158013bc4de295242feecfe
Contents?: true
Size: 771 Bytes
Versions: 33
Compression:
Stored size: 771 Bytes
Contents
# -*- coding: utf-8 -*- # # Copyright 2013 whiteleaf. All rights reserved. # require "win32ole" require_relative "../../extensions/windows" module Device::Library module Windows def get_device_root_dir(volume_name) @@FileSystemObject ||= WIN32OLE.new("Scripting.FileSystemObject") drive_strings = " " * 1000 result_len = WinAPI.GetLogicalDriveStrings(1000, drive_strings) drives = drive_strings[0, result_len].split("\0") drives.each do |drive_letter| drive_info = @@FileSystemObject.GetDrive(drive_letter) vol = drive_info.VolumeName rescue "" if vol.downcase == volume_name.downcase return File.expand_path(drive_letter) end end nil end end end
Version data entries
33 entries across 33 versions & 1 rubygems