Last time is did some Pascal was 2006/7. I think I never saw production-grade code myself.
I wonder if this line is an array in-situ?
Split(APath, [sfodpoWithoutPathDelimiter, sfodpoWithoutExtension], P, N)