Path.expandVars

Path expandVars() const

Expands environment variables in the path string.

Supported patterns:

  • POSIX (all platforms): $VAR and ${VAR} expand to the value of VAR.

If the variable is not defined, the reference is left unchanged.

  • Windows (in addition to $VAR/${VAR}): also expands %VAR%.

Notes:

  • Empty variables expand to an empty string.
  • Braced form ${VAR} takes precedence when both styles are present.
  • This function does not interpret quotes or escapes; it only performs textual expansion.

Returns

A new Path with environment variables expanded.