init
This commit is contained in:
commit
b3dba4542f
44 changed files with 1596 additions and 0 deletions
28
lib/storage.rb
Normal file
28
lib/storage.rb
Normal file
|
@ -0,0 +1,28 @@
|
|||
require 'plist'
|
||||
|
||||
# gem install plist
|
||||
# gem pristine io-console --version 0.7.2
|
||||
|
||||
module Storage
|
||||
|
||||
def self.get_mounting_point(uuid)
|
||||
if RUBY_PLATFORM.include?("darwin")
|
||||
output = `diskutil list -plist`
|
||||
plist = Plist.parse_xml(output)
|
||||
|
||||
plist["AllDisksAndPartitions"].each do |disk|
|
||||
if disk["APFSVolumes"]
|
||||
|
||||
disk["APFSVolumes"].each do |partition|
|
||||
if partition["DiskUUID"] == uuid
|
||||
return partition["MountPoint"]
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
else
|
||||
puts "TODO: Implement for Linux"
|
||||
end
|
||||
return nil
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue