cleanPath static method
Removes leading and trailing path separators from the given filePath
.
Implementation
static String cleanPath(String filePath) {
String filePathClean;
// Remove leading path separator.
if (filePath.startsWith(Platform.pathSeparator)) {
filePathClean = filePath.substring(1);
} else {
filePathClean = filePath;
}
// Remove trailing path separator.
if (filePathClean.endsWith(Platform.pathSeparator)) {
filePathClean = filePathClean.substring(0, filePathClean.length - 1);
}
return filePathClean;
}