>  Docs Center  >  Libraries  >  Markwardt  >  NORMPATH
Libraries

NORMPATH

NORMPATH

Name


  NORMPATH

Author


  Craig B. Markwardt, NASA/GSFC Code 662, Greenbelt, MD 20770
  craigm@lheamail.gsfc.nasa.gov
  UPDATED VERSIONs can be found on my WEB PAGE:
      http://cow.physics.wisc.edu/~craigm/idl/idl.html

Purpose


  Construct an absolute file/directory path from a relative path

Major Topics


  Files, I/O

Calling Sequence


  NORMPATH, FROM, NORMALIZED

Description



  NORMPATH constructs a "normalized" filename or directory path from
  a specified relative path. The relative path may contain path
  components which move up and/or down the hierarchy of the file
  system. The returned path will be the most absolute path that can
  be specified.
  If the user specifies the CURRENT keyword, then relative paths are
  assumed to originate in the CURRENT directory. If CURRENT is not
  specified, then it is possible for the returned path to have
  path components relative to the current directory.
  NORMPATH should be platform independent. Note that the paths do
  not necessarily need to exist on the file system.

Inputs



  FROM - scalar string, gives the relative path.
  NORMALIZED - upon return, the normalized form of FROM.

Keywords



  CURRENT - if specified, must be a scalar string which gives the
            path to the current directory used in forming the
            normalized path. If not specified, then the returned
            path may have some relative components.

Examples



  NORMPATH, '/x/y/z', path & print, path
    '/x/y/z'
  The specified path is already normalized, so there is no action
  NORMPATH, '/x/y/../w/z', path & print, path
    '/x/w/z'
  The specified path had relative components which were removed.
  NORMPATH, '../x/y/../w/z', path & print, path
    '../x/w/z'
  The specified path had relative components which could not be
  removed.
  NORMPATH, '../x/y/../w/z', path, current='/root' & print, path
    '/x/w/z'
  The absolute path of the current directory was given (and then the
  relative path moved outside of /root).

Modification History


  Written and documented, 12 Mar 2004 CM
  Usage message, 23 Mar 2008 CM
  Handle case of 'a//b', which should be 'a/b', 23 Mar 2008 CM



© 2024 NV5 Geospatial Solutions, Inc. |  Legal
   Contact Us