# Class: com.pnfsoftware.jeb.util.base.PathProcessor

The path processor class is used to resolve *flexible paths* \(flexi\-paths\) and lists of multiple flexi\-paths \(multi\-flexi\-paths are flexi\-paths separated by semicolons\). 

 A flexible path can contain environment variables, Windows\-style \(%xxx%\) or Linux\-style \($xxx\). It may also contain alternatives, separated by pipes and enclosed in parenthesis. 

 Example: `/root/($FOO|user)/$BAR/dir1` 

 When alternatives are present, the first plausible one is used.

## Constructor: PathProcessor

Description: Standard constructor.

## Constructor: PathProcessor
- parameter: `smap`, type: `java.util.Map<java.lang.String,java.lang.String>`

Description: Construct a processor with a custom environment map. Usage is discouraged.
parameter: smap: environment variable map used for substitutions

## Static Field: ENV
Type: `com.pnfsoftware.jeb.util.base.PathProcessor`
Description: Shared processor using the process and shell environments.

## Method: decodeFlexiMultiPath
- parameter: `mp`, type: `java.lang.String`
- return type: `java.util.List<java.lang.String>`

Description: Decode multiple flexi\-paths, composed of one or more flexi\-paths separated by semi\-columns.
parameter: mp: a multi\-path
return: a list of resolved paths, possibly empty

## Method: decodeFlexiPath
- parameter: `p`, type: `java.lang.String`
- return type: `java.lang.String`

Description: Decode a single flexi\-path. A flexible path can contain environment variables; it may also contain alternatives, separated by pipes and enclosed in parenthesis. Example: `/root/($FOO|user)/$BAR/dir1`. If alternatives are present, the first plausible one is returned.
parameter: p: a flexi\-path
return: the resolved flexi\-path, null on error

## Method: decodeSinglePath
- parameter: `p`, type: `java.lang.String`
- return type: `java.lang.String`

Description: Decode a simple path \(no flexi path\), by injecting environment variable into it. In addition to [#substituteEnvironmentVariables(String)](#substituteEnvironmentVariables(String)), it consider the path as a full one, allowing to replace the first ~ by user.home. Note that it only manage the homepath of current user \(~/xxx\), not the one from a different user \(~user\)
parameter: p: path with environment variables
return: the resulting real path

## Method: substituteEnvironmentVariables
- parameter: `str`, type: `java.lang.String`
- return type: `java.lang.String`

Description: Substitute the environment variables in a string by their values. 

 Accepted syntax for variables: `$VAR`, `${VAR_WITH_SPECIAL_CHARS}`, `%VAR%`.
parameter: str: input string
return: the resulting string, null on error

