JSContext: adapt to directory changes