New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

`path_home()` produces HOME path with tilde appended w/R installed from sources #60

Closed
kevinushey opened this Issue Jan 31, 2018 · 1 comment

Comments

Projects
None yet
2 participants
@kevinushey
Copy link
Contributor

kevinushey commented Jan 31, 2018

E.g. I see:

> path.expand("~")
[1] "/Users/kevin/~"
> path.expand("~/")
[1] "/Users/kevin/"
> fs::path_home()
/Users/kevin/~

This is almost certainly a consequence of how I've compiled R but it would be nice to handle this edge case since R's handling of ~ expansion depends on whether readline is used (IIUC)

@jimhester

This comment has been minimized.

Copy link
Member

jimhester commented Feb 1, 2018

We simply rely on R's R_ExpandFilename function to expand the home, so fs::path_expand("~/") should return the same as base R.

fs/src/path.cc

Line 87 in 63d3453

SET_STRING_ELT(out, i, Rf_mkCharCE(R_ExpandFileName(p), CE_UTF8));

I guess this implies that path_home() should expand "~/" rather than "~"

@jimhester jimhester closed this in c6b9471 Feb 1, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment