Class: Iso9660::SymbolicLink

Inherits:
Object
  • Object
show all
Defined in:
lib/fs/iso9660/rock_ridge.rb

Overview

RESERVED1: Historically, this component has referred to the directory on which the current CD-ROM is mounted. Reserved2: Historically, this component has contained the network node name of the current system as defined in the uname structure of POSIX 4.4.1.2

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data, _suff) ⇒ SymbolicLink

Returns a new instance of SymbolicLink.



133
134
135
136
137
138
139
# File 'lib/fs/iso9660/rock_ridge.rb', line 133

def initialize(data, _suff)
  sl = RR_SL.decode(data)

  # Reader data.
  @flags = sl['flags']
  @linkData = assembleComponents(sl['components'])
end

Instance Attribute Details

#flagsObject (readonly)

Returns the value of attribute flags.



130
131
132
# File 'lib/fs/iso9660/rock_ridge.rb', line 130

def flags
  @flags
end

#linkDataObject

Returns the value of attribute linkData.



131
132
133
# File 'lib/fs/iso9660/rock_ridge.rb', line 131

def linkData
  @linkData
end

Instance Method Details

#assembleComponents(data) ⇒ Object



141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
# File 'lib/fs/iso9660/rock_ridge.rb', line 141

def assembleComponents(data)
  out = ""; offset = 0
  loop do
    comp = RR_SL_COMPONENT.decode(data[offset..-1])

    # Check for referential flags.
    out += "./" if comp['flags'] & RR_EXT_SLCOMPF_CURRENT != 0
    out += "../" if comp['flags'] & RR_EXT_SLCOMPF_PARENT != 0
    out += "/" if comp['flags'] & RR_EXT_SLCOMPF_ROOT != 0

    # Advance offset, append content (if any) & check for done.
    # puts "Component content:"
    # comp['content'][0, comp['length']].hex_dump(:obj => STDOUT, :meth => :puts, :newline => false)
    # puts "\n\n"
    offset += comp['length'] + 2 # compensate for first two bytes of component.
    next if comp['length'] == 0
    out = File.join(out, comp['content'][0, comp['length']])
    # break if comp['flags'] & RR_EXT_SLCOMPF_CONTINUE == 0
    # Analysis of real data shows the condition is offset >= data len.
    break if offset >= data.length
  end
  # puts "Total content:"
  # out.hex_dump(:obj => STDOUT, :meth => :puts, :newline => false)
  # puts "\n\n"
  out
end