Add support for environment variables and '~' in paths

- Add utility to expand environment variables
- Revise rc-file searching to use new mechanism
- Expand environment variables when opening files
- Adapt filesystem unit tests for new mechanism