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

Consider a first_exists() approach for finding the tz directory? #1137

Open
MichaelChirico opened this issue Oct 2, 2023 · 1 comment
Open

Comments

@MichaelChirico
Copy link
Contributor

lubridate/R/tzdir.R

Lines 55 to 61 in e54b612

tzdirs <- tzdirs[file.exists(tzdirs)]
if (length(tzdirs)) {
tzdirs[[1]]
} else {
NULL
}
}

Happened to notice this helper has a lot of overlap with lintr:::find_config().

Recently tested that looping over the potential locations & returning the first found is much faster than checking all of them:

r-lib/lintr#2204

Would that be preferable here as well?

@vspinu
Copy link
Member

vspinu commented Oct 5, 2023

Indeed, it does not make sense to check all of them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants