Use proj_path_prep() on path from rstudioapi#485
Conversation
> test(filter = "proj")
Loading usethis
✔ Setting active project to '/Users/jenny/rrr/usethis'
Testing usethis
✔ | OK F W S | Context
✖ | 25 3 | projects [0.5 s]
───────────────────────────────────────────────────────────────────────────────────────────────────────────
test-proj.R:85: failure: proj_set() enforces proj path preparation policy
path_rel(proj_get(), a) not equal to "b/d".
1/1 mismatches
x[1]: "b2/d"
y[1]: "b/d"
test-proj.R:136: failure: with_project() runs code in temp proj, restores original proj
res[["active_usethis_proj"]] not identical to as.character(new_proj).
1/1 mismatches
x[1]: "/private/var/folders/yx/3p5dt4jj1019st0x90vhm9rr0000gn/T/RtmpI8hOSz/aaa922a2cabc31b"
y[1]: "/var/folders/yx/3p5dt4jj1019st0x90vhm9rr0000gn/T/RtmpI8hOSz/aaa922a2cabc31b"
test-proj.R:154: failure: local_project() activates proj til scope ends
res[["active_usethis_proj"]] not identical to as.character(new_proj).
1/1 mismatches
x[1]: "/private/var/folders/yx/3p5dt4jj1019st0x90vhm9rr0000gn/T/RtmpI8hOSz/aaa922a40963886"
y[1]: "/var/folders/yx/3p5dt4jj1019st0x90vhm9rr0000gn/T/RtmpI8hOSz/aaa922a40963886"
───────────────────────────────────────────────────────────────────────────────────────────────────────────
══ Results ════════════════════════════════════════════════════════════════════════════════════════════════
Duration: 0.6 s
OK: 25
Failed: 3
Warnings: 0
Skipped: 0 |
|
I don't mind updating rprojroot to use fs, if that helps. |
|
(@jennybc I updated this PR against master so make sure to |
|
@jimhester Will you try this PR and see if it fixes your workflow on a Windows VM with a mapped network drive? This version processes a path from rstudioapi as if it was an external user-provided path. |
|
@jimhester Will you try this PR and see if it fixes your workflow on a Windows VM with a mapped network drive? This version processes a path from rstudioapi as if it was an external user-provided path. |
|
@jimhester We will release usethis soon. If you're still interested in this (I am!), will you try this PR and see if it fixes your workflow on a Windows VM with a mapped network drive? This version processes a path from rstudioapi as if it was an external user-provided path. |
jimhester
left a comment
There was a problem hiding this comment.
So I finally tried this, extremely sorry for the delay!
It looks good and I verified it works with a mapped network drive on Windows.
Thanks!
Closes #479 Have
usethis::proj_path_prep()usefs::path_abs(fs::path_expand())instead offs::path_real()This causes 4 tests to fail. One was an easy and positive fix. One could be fixed (removed?), as it is literally testing for path realization. That is the first failure you see below.
The remaining 2 failures suggest a concrete reason why I used
path_real()in the first place:rprojroot::find_root()returns a normalized path, in the sense ofnormalizePath(). That would not be particularly easy to fix / workaround.This points out the difficulty of adopting a fs mindset when handing paths to/from other packages that use the base path handling toolkit. I have experienced similar pain with paths from RStudio via rstudioapi.
So if we want to do this, we will need to somehow put more wrapping around
rprojroot::find_root(). Update: or, alternatively, more wrapping around any paths created by rstudioapi.