properly escape root path before turning into regExp in write-map.js

finish test cases for write-map