Split FilePath into DirPath and FilePath

Maybe a silly question but is there a way to not use unsafe for this kind of operation (eg. a method that returns some kind of `Option[FileName]`, except that I don't see how that would work anyway).