Based on Mark's suggestions, the best I've come up with is:
userlib <- function(username){
userlib <- path.expand(sub("~", paste0("~", username), Sys.getenv("R_LIBS_USER"), fixed=TRUE));
if(file.exists(userlib)){
return(userlib)
} else {
return("")
}
}
This seems to give what I need, at least on Linux and OSX.