Fix path from file to directory