Support large paths and systems with no PATH_MAX.
Support large paths and systems with no PATH_MAX.

- getcwd can be called with an expanding path size, so use it
- limiting buffer resize to not try again if buffer > 8k

digitalbazaar/monarch,digitalbazaar/monarch,digitalbazaar/monarch,digitalbazaar/monarch,digitalbazaar/monarch