Fix path splitting algorithm to handle multiple trailing slashes.

The old algorithm was detecting just a single trailing slash correctly,
creating bogus empty path entry at the end of path entry list
in case of multiple trailing slashes.

Signed-off-by: Oleg Girko <oleg.girko@jolla.com>