make directory operation portable