Extract method for EnsureTrailingPathSeparator

Put KindDragon's coding guideline(https://github.com/gitextensions/gitextensions/commit/bb004106fb3fccafc502709766434657750fa652#commitcomment-2376887) into a method.