Skip to content
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

* Improved write_greta_install_log() and read_greta_install_log() #712

Merged
merged 3 commits into from
Aug 21, 2024

Conversation

njtierney
Copy link
Collaborator

Use tools::R_user_dir() to always write to a file location. read_greta_install_log() will open one found from an environment variable or go to the default location. (#703)

Thanks @maelle for this excellent suggestion!

… to use `tools::R_user_dir()` to always write to a file location. `read_greta_install_log()` will open one found from an environment variable or go to the default location. (greta-dev#703)
@njtierney njtierney added this to the 0.5.0 milestone Aug 20, 2024
Copy link
Contributor

@maelle maelle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so neat 😸

#' not specified the `GRETA_INSTALLATION_LOG` environmental variable, the
#' installation notes will indicate how to use [write_greta_install_log()].
#' `greta_set_install_logfile('path/to/logfile.html')`. By default it uses
#' `tools::R_user_dir("greta")`. To see installation notes or errors, after
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tools::R_user_dir("greta") is a folder so what's the file path?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point!

greta_default_logfile <- function(){
greta_user_dir <- get_pkg_user_dir()
default_greta_logfile_path <- glue::glue(
"{greta_user_dir}/greta-installation-logfile.html"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not file.path(greta_user_dir, "greta-installation-logfile.html")? I once read one should not paste to create a path but I can't remember why (the slash difference on OS? something else?)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point! I'm in a habit using glue for everything.

@njtierney njtierney merged commit f31a0db into greta-dev:master Aug 21, 2024
8 checks passed
@njtierney njtierney deleted the save-logfiles-local-703 branch August 21, 2024 00:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Development

Successfully merging this pull request may close these issues.

2 participants