Bai-Li-NOAA / Age_Structured_Stock_Assessment_Model_Comparison

Other
0 stars 6 forks source link

`run_om()` leaves you in `maindir` #8

Open kellijohnson-NOAA opened 2 years ago

kellijohnson-NOAA commented 2 years ago

run_om() uses setwd() to change your directory (see below) https://github.com/Bai-Li-NOAA/Age_Structured_Stock_Assessment_Model_Comparison/blob/a591ec6e1022893f75ab4bc4193f91fe49b51055/R/run_om.R#L73 but there is no call to get you out, e.g.,

originalwd <- getwd()
setwd(maindir)
on.exit(setwd(originalwd), add = TRUE)

I think that this function could operate without changing directories with some augmentation, which would be more ideal than implementing the above code.

Bai-Li-NOAA commented 2 years ago

Thanks Kelli. Will test it and make changes to the code.