This patch aims to make the persistent undo functionality work out of the place.
Used for temp dirs/files such as undodir