| 1 | package fr.sii.ogham.core.util; | |
| 2 | ||
| 3 | import java.nio.file.Path; | |
| 4 | import java.util.StringJoiner; | |
| 5 | ||
| 6 | /** | |
| 7 | * Utility class to handle resources | |
| 8 | * | |
| 9 | * @author Aurélien Baudet | |
| 10 | * | |
| 11 | */ | |
| 12 | public final class ResourceUtils { | |
| 13 | /** | |
| 14 | * Convert a path that is dependent on OS to a resource path (using slashes). | |
| 15 | * | |
| 16 | * @param path the path to convert | |
| 17 | * @return the converted path | |
| 18 | */ | |
| 19 | public static String toResourcePath(Path path) { | |
| 20 |
2
1. toResourcePath : negated conditional → RUN_ERROR 2. toResourcePath : negated conditional → RUN_ERROR |
StringJoiner joiner = new StringJoiner("/", path.startsWith("/") ? "/" : "", path.endsWith("/") ? "/" : ""); |
| 21 |
1
1. toResourcePath : removed call to java/nio/file/Path::forEach → RUN_ERROR |
path.forEach(p -> joiner.add(p.toString())); |
| 22 |
1
1. toResourcePath : replaced return value with "" for fr/sii/ogham/core/util/ResourceUtils::toResourcePath → RUN_ERROR |
return joiner.toString(); |
| 23 | } | |
| 24 | ||
| 25 | private ResourceUtils() { | |
| 26 | super(); | |
| 27 | } | |
| 28 | } | |
Mutations | ||
| 20 |
1.1 2.2 |
|
| 21 |
1.1 |
|
| 22 |
1.1 |