check if module is a directory in workspace before calling pruneEmptyDirectories