r-lib / pkgload

Simulate installing and loading a package
http://pkgload.r-lib.org
58 stars 46 forks source link

Export `shim_system.file` & `dev_packages`? #223

Closed yogat3ch closed 2 years ago

yogat3ch commented 2 years ago

Hey pkgload devs, We're using the golem framework for building shiny apps which makes it such that the location of files changes between our development environment and where they're found once the app is deployed as a package. It would be super useful for us to be able to use shim_system.file and dev_packages in our functions that create directory paths such that all the file paths work in both scenarios. Could this be function be exported?

lionel- commented 2 years ago

You can use fs::path_package() instead of system.file().

We don't recommend having a lot of branched code for dev and install paths. Why do you need dev_packages()? We already have is_dev_package() exported which can be occasionally useful.

yogat3ch commented 2 years ago

Hi @lionel- , Thank you for the quick response! It does look like fs::path_package & is_dev_package in combination with pkgload::pkg_name will cover our needs. Thanks for pointing me in the right direction 🙏