lib/slowfat/filesystem.rb
##
# Access a directory within this filesystem.
# @param dirname [String] the path to retrieve a directory object for
# @return [Directory] the directory object matching the requested path
Access a directory within this filesystem.
Access a directory within this filesystem .
def dir(dirname)
      path_elements = dirname.split('/')
      current_dir_base = @rootdir_base
      next_dir = nil
      max_entries = 32
      path_elements.each do |path_element|
        this_dir = Directory.new(backing: @backing, base: current_dir_base, max_entries: max_entries)
        next_dir = this_dir.dir_entry(path_element)
        return nil if next_dir == nil
        next_dir_base = @data_base + next_dir.start_cluster*@cluster_size
        max_entries = @cluster_size/32
        current_dir_base = next_dir_base
      end
      Directory.new(backing: @backing, base: current_dir_base, max_entries: max_entries)
    end
def dir ( dirname ) path_elements = dirname . split ( '/' ) current_dir_base = @rootdir_base next_dir = nil max_entries = 32 path_elements . each do | path_element | this_dir = Directory . new ( backing : @backing , base : current_dir_base , max_entries : max_entries ) next_dir = this_dir . dir_entry ( path_element ) return nil if next_dir == nil next_dir_base = @data_base + next_dir . start_cluster * @cluster_size max_entries = @cluster_size / 32 current_dir_base = next_dir_base end Directory . new ( backing : @backing , base : current_dir_base , max_entries : max_entries ) end
Access a directory within this filesystem.
Access a directory within this filesystem .
# TODO: accept either / or \ # all directories except the root have more entries available
the directory object matching the requested path
the directory object matching the requested path
Directory
dirname
the path to retrieve a directory object for
the path to retrieve a directory object for