Skip to content

Commit 1cb7c79

Browse files
committed
fix: build local paths in a portable way
Signed-off-by: Fred Bricon <fbricon@gmail.com>
1 parent 70bef62 commit 1cb7c79

1 file changed

Lines changed: 19 additions & 6 deletions

File tree

src/models/Dependency.ts

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import * as os from "os";
2+
import * as path from "path";
23

34
const HOME = os.homedir();
45

@@ -50,9 +51,15 @@ export function getLocalFile(
5051
) {
5152
return undefined;
5253
}
53-
return `${HOME}/.m2/repository/${getSplitGroupId(
54-
groupId
55-
)}/${artifactId}/${version}/${artifactId}-${version}.pom`;
54+
return path.join(
55+
HOME,
56+
".m2",
57+
"repository",
58+
getSplitGroupId(groupId),
59+
artifactId,
60+
version,
61+
`${artifactId}-${version}.pom`
62+
);
5663
}
5764

5865
export function getRemoteUrl(
@@ -96,9 +103,15 @@ export function getRemoteRepositoriesFile(
96103
) {
97104
return undefined;
98105
}
99-
return `${HOME}/.m2/repository/${getSplitGroupId(
100-
groupId
101-
)}/${artifactId}/${version}/_remote.repositories`;
106+
return path.join(
107+
HOME,
108+
".m2",
109+
"repository",
110+
getSplitGroupId(groupId),
111+
artifactId,
112+
version,
113+
"_remote.repositories"
114+
);
102115
}
103116

104117
function getSplitGroupId(groupId: string): string {

0 commit comments

Comments
 (0)