It is because the method itself returns the PATH of the nodeRef (where the nodeRef actually lies).
So for example your file test.pdf lies in Company Home/FolderA then the method getPath() should return -> Company Home/FolderA; and not Company Home/FolderA/test.pdf
In your case, if your nodeRef lies in C folder ( A/B/C ), and still the method getPath() returns A/B, then you need to verify the nodeRef once. It might be incorrect.