class ExFTP

Public Instance Methods

mkdir_p(dir) click to toggle source
# File lib/active_storage_ftp/ex_ftp.rb, line 4
def mkdir_p(dir)
  parts = dir.split("/")
  if parts.first == "~"
    growing_path = ""
  else
    growing_path = "/"
  end
  for part in parts
    next if part == ""
    if growing_path == ""
      growing_path = part
    else
      growing_path = File.join(growing_path, part)
    end
    begin
      mkdir(growing_path)
      chdir(growing_path)
    rescue Net::FTPPermError, Net::FTPTempError => e
    end
  end
end