if (Platforms.FILE_PATH_SEPARATOR.equals(parentPath)) {
return parentPath;
}
parentPath = MoreStringUtil.removeEnd(parentPath, Platforms.FILE_PATH_SEPARATOR_CHAR);
int idx = parentPath.lastIndexOf(Platforms.FILE_PATH_SEPARATOR_CHAR);
<BUG>if (idx >= 0)
</BUG>
parentPath = parentPath.substring(0, idx + 1);
<BUG>else
parentPath = Platforms.FILE_PATH_SEPARATOR;
return parentPath;</BUG>
}

if (Platforms.FILE_PATH_SEPARATOR.equals(parentPath)) {
return parentPath;
}
parentPath = MoreStringUtil.removeEnd(parentPath, Platforms.FILE_PATH_SEPARATOR_CHAR);
int idx = parentPath.lastIndexOf(Platforms.FILE_PATH_SEPARATOR_CHAR);
if (idx >= 0) {
parentPath = parentPath.substring(0, idx + 1);
} else {
parentPath = Platforms.FILE_PATH_SEPARATOR;
}
return parentPath;
}
