DoubleYouGTT / hubspot

R package πŸ“¦ for working with Hubspot πŸ‘©β€πŸ’ΌπŸ‘¨β€πŸ’Ό data
https://itsalocke.com/hubspot/
Other
10 stars 8 forks source link

set_renv not handling my file path #59

Open stephlocke opened 4 years ago

stephlocke commented 4 years ago

The set_renv() function is returning weirdly for me. The below file path is the one generated in the token create function.

> set_renv("HUBSPOT_PAT" = "C:\\Users\\steph\\OneDrive\\Documents/.hubspot_token1.rds")
> Sys.getenv("HUBSPOT_PAT")
[1] "C:UsersstephOneDriveDocuments/.hubspot_token1.rds"
maelle commented 4 years ago

You mean when running hubspot_token_create()?

stephlocke commented 4 years ago

Yep

maelle commented 4 years ago

Did you run it with a token path argument or is this the default?

maelle commented 4 years ago

And if it was not the default how does the file path the default would return look like for you?

https://github.com/lockedata/hubspot/blob/0c831d66c11820ede65e798847481727e6fec21a/R/hubspot_oauth.R#L122

stephlocke commented 4 years ago

That was with the default - the string above was the output generated by uq_filename()

maelle commented 4 years ago

And does the string look weird in .Renviron already? Or only when retrieving it via Sys.getenv?

maelle commented 4 years ago

@stephlocke a few questions

Thanks!

maelle commented 4 years ago

Besides, did you use rtweet stuff on your machine?

stephlocke commented 4 years ago

The hubspot looks like HUBSPOT_PAT=C:\Users\steph\OneDrive\Documents/.hubspot_token1.rds whereas rtweet lookes like TWITTER_PAT=C:/Users/steph/OneDrive/Documents/.rtweet_token2.rds

Removing the HUBSPOT_PAT and reauthing with set_renv results in the same backslashes

> Sys.getenv("HOME")
[1] "C:\\Users\\steph\\OneDrive\\Documents"
> file.path(Sys.getenv("HOME"))
[1] "C:\\Users\\steph\\OneDrive\\Documents"
> file.path(normalizePath("~"))
[1] "C:\\Users\\steph\\OneDrive\\Documents"