Primitives for basename and dir, for 3 backends