class SlowFat::Directory::Dentry
Attributes
extension[R]
@return [String] the file extension
filename[R]
@return [String] the name of the file or other directory entry
size[R]
@return [Integer] the size of the file in bytes
start_cluster[R]
@return [Integer] the starting cluster of this file in the backing
type[R]
@return [Symbol] the type of item this dentry describes
Public Class Methods
new(dir_data)
click to toggle source
Initialize a new directory entry (normally only called from Directory
) @param dir_data [String] the data making up this dentry in the backing
# File lib/slowfat/dir.rb, line 84 def initialize(dir_data) case dir_data[0].ord when 0x00 # end of directory entries @type = :end_of_dentries return when 0x2E # dot entry @dotdir = true when 0xE5 # deleted file @deleted = true end (@filename, @extension, attrib_bits, reserved, mod_date, mod_time, @start_cluster, @size) = dir_data.unpack('A8A3Ca10vvvV') @read_only = attrib_bits & 0x01 > 0 @hidden = attrib_bits & 0x02 > 0 @system = attrib_bits & 0x04 > 0 @archive = attrib_bits & 0x20 > 0 @device = attrib_bits & 0x40 > 0 @type = :file @type = :volume_label if attrib_bits & 0x08 > 0 @type = :directory if attrib_bits & 0x10 > 0 end
Public Instance Methods
archive?()
click to toggle source
Returns true if this dentry has the archive attribute set
# File lib/slowfat/dir.rb, line 130 def archive? @archive end
deleted?()
click to toggle source
Returns true if this dentry is a file that has been deleted
# File lib/slowfat/dir.rb, line 142 def deleted? @deleted end
device?()
click to toggle source
Returns true if this dentry has the device attribute set
# File lib/slowfat/dir.rb, line 136 def device? @device end
dotdir?()
click to toggle source
Returns true if this dentry is a dot directory (. or ..)
# File lib/slowfat/dir.rb, line 148 def dotdir? @dotdir end
read_only?()
click to toggle source
Returns true if this dentry has the read only attribute set
# File lib/slowfat/dir.rb, line 112 def read_only? @read_only end
system?()
click to toggle source
Returns true if this dentry has the system attribute set
# File lib/slowfat/dir.rb, line 124 def system? @system end