Functions to inform user of correct access. #5
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Initial functions that check and inform the user of their access to the lookups directory.
The way I've set it up is to check access once the package is loaded (either through library or by accessing any function) and if they have access a message appears telling them that this is the case. This message will appear once per session so basically once the package is loaded.
If at the point of loading the package they do not have access, a warning is thrown informing them of this and steps to remedy it.
This is done internally through the
check_access()
function which throw either an error or a warning, depending on what you prefer (specified through theerror_on_no_access
arg).I've done it this way so that when loading the package it doesn't cause a user's entire script to fail just because they may or may not use the lookup files.
But if we want to internally use
check_access()
, say at the start ofget_spd()
then an error will be thrown by default if there is no access (unlikely as the access was checked at the point of loading the package).I've exported a
have_access()
function which just returnsTRUE
orFALSE
depending on if the user has access to the lookups dir.