filenameExpand

fnstring filenameExpand(string path) @trusted

Expands environment variables and tilde in a filename.

Replaces `~` with the user's home directory and expands environment variables in the form $VAR or ${VAR}.

Parameters

pathPath containing variables to expand

Returns

The expanded path, or the original path if no expansion was needed.

Example:

// Expands ~ to home directory
auto home = filenameExpand("~");
assert(home.length > 0);
assert(home[0] == '/');