ATFutures / geoplumber

Serve geographic data from R and consume with scalable front end.
https://atfutures.github.io/geoplumber/
59 stars 7 forks source link

gp_plumb changes the working directory #77

Closed Robinlovelace closed 4 years ago

Robinlovelace commented 4 years ago

Should it change back to the original e.g. with:

old = setwd("app")
# ... plumb
setwd(old)
layik commented 4 years ago

So this should not be happening and it is not a bug. The way gp_plumb works, in my opinion should not change dir. The other instance where the relevant function is used, is in gp_build which respects user's directory pref.

It should always be the user who would need to be in a gp project directory. Happy to remove both references to the relevant function.

The function itself could be exported as a helper function, users may or may not use it.

Robinlovelace commented 4 years ago

If there's a setting like cd = FALSE by default, it could cd with a message but by default only work if you're already in an app directory.

layik commented 4 years ago

Just to be clear, if I remove the offending line, all that is going to happen is a warning to user that please be in a gp dir. The alternative would be to provide a geoplumber path which I think is messy. So example would be usethis::use_package("stats19", path="/some/path").

As for cd = FALSE or other work arounds, a couple of things but main point is I have not worked out how to overcome running code after a plumber blocking thread is "killed". So I can reset user pref after plumber is done. Because if user says cd = FALSE they might as well just cd into a project and as all they will get is the warning.

Slightly related to #82

layik commented 4 years ago

So it is a matter of package strategy as well.

layik commented 4 years ago

Should not do so now. Closing.