improved path/file parsing