I am seeing crash reports from resolve_links and I can’t think of any other reason for this crash, than readlink() returning a value which is neither -1 nor in the range [0..len].
We now leave a potential trailing slash in the result.
This fixes the issue of the missing slash in ⌘T — while I normally prefer the slash to be stripped, I think path::with_tilde should be an exception since effectively it is just replacing the path prefix, it shouldn’t do any real processing (although we do actually normalize the string).
Also fix a bug where we would use tilde for paths pointing to a user folder for a user with current user’s name as prefix.
This is actually not entirely trivial since we can have a path that starts with a slash but includes more ‘..’ components than there are actual directories in the path.
Incase we do a git commit that launches TextMate, it will inherit a bunch of variables from git, including GIT_DIR, which will cause issues for the Git bundle.
Previously this was under the OakSystem framework which depends on the io framework meaning that the io framework itself was unable to obtain a basic environment, which is necessary for next commit.