4
誰能告訴我如何獲取可用磁盤驅動器列表中的紅寶石?我正在創建一個打開的文件對話框,需要知道!在此先感謝,埃爾。Ruby獲取可用磁盤驅動器
誰能告訴我如何獲取可用磁盤驅動器列表中的紅寶石?我正在創建一個打開的文件對話框,需要知道!在此先感謝,埃爾。Ruby獲取可用磁盤驅動器
文章布賴恩給正確地指出了下面的代碼:
require 'win32ole'
file_system = WIN32OLE.new("Scripting.FileSystemObject")
drives = file_system.Drives
drives.each do |drive|
puts "Available space: #{drive.AvailableSpace}"
puts "Drive letter: #{drive.DriveLetter}"
puts "Drive type: #{drive.DriveType}"
puts "File system: #{drive.FileSystem}"
puts "Is ready: #{drive.IsReady}"
puts "Path: #{drive.Path}"
puts "Root folder: #{drive.RootFolder}"
puts "Serial number: #{drive.SerialNumber}"
puts "Share name: #{drive.ShareName}"
puts "Total size: #{drive.TotalSize}"
puts "Volume name: #{drive.VolumeName}"
end
這在windows是/ Linux的/ Mac OSX版?如果是Windows,請查看這篇文章:http://www.ruby-forum.com/topic/88875#170688 – Brian 2010-07-15 18:32:06
是的,它是Windows,非常感謝你,你一直很有幫助,我很感激! – Ell 2010-07-15 18:46:00