During development packages are often loaded directly from source using
I think that when a package is tested using
devtools::test it is loaded directly from source as well.
base::system.file() function will not work when a package is loaded from source using
load_all because the "/inst" folder still exists. When a package is installed the files in "inst" are copied up one level in the directory hierarchy.
There is an internal function in pkgload called
pkgload:::shim_system.file() that is supposed to intercept calls to
base::system.file(), so that it behaves well with packages loaded by devtools. It is made available when a package is loaded with
Sometimes this works well but I often find that this does not work. It seems that calls to
system.file are not being correctly intercepted and tests are failing because of the missing '/inst' in file paths.
Do others experience this issue? Is there a way to debug the calls to
system.file to understand why the shim is not working?