Contributed directory handling to politburo project's babushka-deps. Can be used from there.