[MRELEASE-261] avoid mis-handling base directories where all modules start with the same sequence of characters. Add tests and fix for Windows paths.