class VagrantPlugins::GuestLinux::Cap::SSHFSGetAbsolutePath

Public Class Methods

sshfs_get_absolute_path(machine, path) click to toggle source
# File lib/vagrant-sshfs/cap/guest/linux/sshfs_get_absolute_path.rb, line 5
def self.sshfs_get_absolute_path(machine, path)
  abs_path = ""
  machine.communicate.execute("readlink -f #{path}") do |type, data|
    if type == :stdout
      abs_path = data
    end
  end

  if ! abs_path
    # If no real absolute path was detected then error out
    error_class = VagrantPlugins::SyncedFolderSSHFS::Errors::SSHFSGetAbsolutePathFailed
    raise error_class, path: path
  end

  # Chomp the string so that any trailing newlines are killed
  return abs_path.chomp
end