Method: PDK::Util.canonical_path

Defined in:
lib/pdk/util.rb

.canonical_path(path) ⇒ String

Return an expanded, absolute path

Parameters:

  • path (String)

    Existing path that may not be canonical

Returns:

  • (String)

    Canonical path



44
45
46
47
48
49
50
51
52
53
# File 'lib/pdk/util.rb', line 44

def canonical_path(path)
  if Gem.win_platform?
    unless File.exist?(path)
      raise PDK::CLI::FatalError, _("Cannot resolve a full path to '%{path}', as it does not currently exist.") % { path: path }
    end
    Puppet::Util::Windows::File.get_long_pathname(path)
  else
    File.expand_path(path)
  end
end