We were getting crashes on config repo update, due to swapSymlink returning a relative path that we then passed to removeDirectoryRecursive.
We should not have got to removeDirectoryRecursive at all, but the check unlessM (fileExist path) action means "do action unless path exists", i.e. "only do action if path doesn't exist". That is, I got my booleans backwards. Oops.
I've replaced that check with something that just removes the directory regardless and catches the "doesn't exist" exception. This has the benefit of being more correct.
Also wrote some tests, since the file-on-disk stuff is quite statey.
I'll merge this tomorrow unless someone reviews before then.
We were getting crashes on config repo update, due to
swapSymlink
returning a relative path that we then passed toremoveDirectoryRecursive
.We should not have got to
removeDirectoryRecursive
at all, but the checkunlessM (fileExist path) action
means "doaction
unlesspath
exists", i.e. "only doaction
ifpath
doesn't exist". That is, I got my booleans backwards. Oops.I've replaced that check with something that just removes the directory regardless and catches the "doesn't exist" exception. This has the benefit of being more correct.
Also wrote some tests, since the file-on-disk stuff is quite statey.
I'll merge this tomorrow unless someone reviews before then.