[RDY] Move more functions into path.c

Moving more path/file-related stuff into path.c to avoid duplicated functionality across modules and to make refactoring easier, as per #414.