Implement per-thread current directory
map chdir paths
helper function should be static