introduce first-order support for resource directories 

@Deravel deleted old branch and opened new pull request