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



85
86
87
88
89
90
91
92
93
94
# File 'lib/pdk/util.rb', line 85

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