Sha256: 5defca918dc365ae2766a2bad2923e101e0a46f4ee24f868f6491bfbc2a46c9d

Contents?: true

Size: 564 Bytes

Versions: 3

Compression:

Stored size: 564 Bytes

Contents

class PathHelper
  #This produces a hashed path very similar to mogilefs just without the device id.  It also recursively creates the
  #directory inside the backup
  def self.path(sfid)
    sfid = "#{sfid}"
    length = sfid.length
    if length < 10
      nfid = "0" * (10 - length) + sfid
    else
      nfid = fid
    end
    /(?<b>\d)(?<mmm>\d{3})(?<ttt>\d{3})(?<hto>\d{3})/ =~ nfid

    #create the directory
    directory_path = "#{$backup_path}/#{b}/#{mmm}/#{ttt}"
    FileUtils.mkdir_p(directory_path)

    return "#{directory_path}/#{nfid}.fid"
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
mogbak-0.2.1 lib/path_helper.rb
mogbak-0.2.0 lib/path_helper.rb
mogbak-0.1.2 lib/path_helper.rb