|
17 | 17 | package com.google.cloud.tools.jib.image;
|
18 | 18 |
|
19 | 19 | import com.google.cloud.tools.jib.filesystem.AbsoluteUnixPath;
|
20 |
| -import com.google.common.base.Preconditions; |
21 | 20 | import java.nio.file.Path;
|
22 | 21 | import java.util.Objects;
|
23 |
| -import java.util.StringJoiner; |
24 | 22 |
|
25 | 23 | /**
|
26 | 24 | * Represents an entry in the layer. A layer consists of many entries that can be converted into tar
|
|
36 | 34 | */
|
37 | 35 | public class LayerEntry {
|
38 | 36 |
|
39 |
| - /** |
40 |
| - * Stringifies {@code path} in Unix form. The path must be absolute. |
41 |
| - * |
42 |
| - * @param path the path |
43 |
| - * @return the string form of the absolute path |
44 |
| - */ |
45 |
| - private static String toUnixPath(Path path) { |
46 |
| - Preconditions.checkArgument( |
47 |
| - path.getRoot() != null, "Tried to stringify a non-absolute path: %s", path); |
48 |
| - |
49 |
| - StringJoiner pathJoiner = new StringJoiner("/", "/", ""); |
50 |
| - for (Path pathComponent : path) { |
51 |
| - pathJoiner.add(pathComponent.toString()); |
52 |
| - } |
53 |
| - return pathJoiner.toString(); |
54 |
| - } |
55 |
| - |
56 | 37 | private final Path sourceFile;
|
57 | 38 | private final AbsoluteUnixPath extractionPath;
|
58 | 39 |
|
@@ -108,7 +89,7 @@ public AbsoluteUnixPath getExtractionPath() {
|
108 | 89 | * @return the source file path
|
109 | 90 | */
|
110 | 91 | public String getAbsoluteSourceFileString() {
|
111 |
| - return toUnixPath(sourceFile.toAbsolutePath()); |
| 92 | + return AbsoluteUnixPath.fromPath(sourceFile.toAbsolutePath()).toString(); |
112 | 93 | }
|
113 | 94 |
|
114 | 95 | /**
|
|
0 commit comments