Skip to content

Commit fb7244f

Browse files
maennchensschuberth
authored andcommitted
refactor(gleam): Use / operator instead of resolve() for paths
Signed-off-by: Jonatan Männchen <jonatan@maennchen.ch>
1 parent 308b337 commit fb7244f

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

plugins/package-managers/gleam/src/funTest/kotlin/GleamFunTest.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ class GleamFunTest : StringSpec({
102102
getAssetFile("projects/synthetic/no-lockfile").copyRecursively(projectDir)
103103

104104
val result = createGleam().resolveSingleProject(
105-
projectDir.resolve("gleam.toml"),
105+
projectDir / "gleam.toml",
106106
resolveScopes = true,
107107
allowDynamicVersions = true
108108
)
@@ -116,7 +116,7 @@ class GleamFunTest : StringSpec({
116116
getAssetFile("projects/synthetic/no-lockfile-broken").copyRecursively(projectDir)
117117

118118
val result = createGleam().resolveSingleProject(
119-
projectDir.resolve("gleam.toml"),
119+
projectDir / "gleam.toml",
120120
resolveScopes = true,
121121
allowDynamicVersions = true
122122
)

plugins/package-managers/gleam/src/main/kotlin/ManifestPackageInfo.kt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ import org.ossreviewtoolkit.model.SourceCodeOrigin
3333
import org.ossreviewtoolkit.model.VcsInfo
3434
import org.ossreviewtoolkit.model.utils.prependPath
3535
import org.ossreviewtoolkit.plugins.packagemanagers.gleam.GleamManifest.Package.SourceType
36+
import org.ossreviewtoolkit.utils.common.div
3637
import org.ossreviewtoolkit.utils.ort.normalizeVcsUrl
3738

3839
/**
@@ -175,8 +176,8 @@ private fun generateCpe(repositoryUrl: String, version: String): String? {
175176
* Returns true if the resolved path is within the analysis root.
176177
*/
177178
private fun isValidLocalPath(analysisRoot: File, workingDir: File, path: String): Boolean {
178-
val resolvedPath = workingDir.resolve(path).canonicalFile
179-
return resolvedPath.startsWith(analysisRoot.canonicalFile)
179+
val resolvedPath = workingDir / path
180+
return resolvedPath.canonicalFile.startsWith(analysisRoot.canonicalFile)
180181
}
181182

182183
/**

0 commit comments

Comments
 (0)