EPICS::Path

# NAME

EPICS::Path - Path-handling utilities for EPICS tools

# SYNOPSIS

      use lib '/path/to/base/lib/perl';
      use EPICS::Path;

      my $dir = UnixPath('C:\Program Files\EPICS');
      print LocalPath($dir), "\n";
      print AbsPath('../lib', $dir);

# DESCRIPTION

This module provides functions for processing pathnames that are commonly needed by EPICS tools. Windows is not the only culprit, some older automount daemons insert strange prefixes into absolute directory paths that we have to remove before storing the result for use later.

Note that these functions are only designed to work on operating systems that recognize a forward slash `/` as a directory separator; this does include Windows, but not pre-OS-X versions of MacOS which used a colon `:` instead.

# FUNCTIONS

`UnixPath($path)`

  `UnixPath` should be used on any pathnames provided by external tools to convert them into a form that Perl understands.

  On cygwin we convert Windows drive specs to the equivalent cygdrive path, and on Windows we switch directory separators from back-slash to forward slashes.

`LocalPath($path)`

  `LocalPath` should be used when generating pathnames for external tools or to put into a file. It converts paths from the Unix form that Perl understands to any necessary external representation, and also removes automounter prefixes to put the path into its canonical form.

  Before Leopard, the Mac OS X automounter inserted a verbose prefix, and in case anyone is still using SunOS (pre-Solaris) it added its own prefix as well.

`AbsPath($path)`
`AbsPath($path, $cwd)`

  The `abs_path()` function in Perl's Cwd module doesn't like non-existent path components other than in the final position, but EPICS tools needs to be able to handle them in paths like $(TOP)/lib/$(T_A) before the $(TOP)/lib directory has been created.

  `AbsPath` takes a path `$path` and optionally an absolute path to a directory that the first is relative to; if the second argument is not provided the current working directory is used instead. The result returned has also been filtered through `LocalPath()` to remove any automounter prefixes.

# COPYRIGHT AND LICENSE

Copyright (C) 2008 UChicago Argonne LLC, as Operator of Argonne National Laboratory.

This software is distributed under the terms of the EPICS Open License.