add flag to getPath to retur the string without trailing slash