remove the filename from the directory path (fix Save As bug on 10.6)