Removes a trailing slash from the path if it has one.
String removeTrailingSlash(String path) { if (path.endsWith(kPathSeparator)) { return path.substring(0, path.length - 1); } return path; }