diff --git a/codegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core/testutil/Rust.kt b/codegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core/testutil/Rust.kt index d97d32a444..0d6d3403e2 100644 --- a/codegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core/testutil/Rust.kt +++ b/codegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core/testutil/Rust.kt @@ -87,12 +87,8 @@ object TestWorkspace { private val subprojects = mutableListOf() private val cargoLock: File by lazy { - var curFile = File(this.javaClass.protectionDomain.codeSource.location.path) - while (!curFile.endsWith("smithy-rs")) { - curFile = curFile.parentFile - } - - curFile.resolve("aws/sdk/Cargo.lock") + val projectDir = "git rev-parse --show-toplevel".runCommand().replace("\n", "") + File(projectDir).resolve("aws/sdk/Cargo.lock") } init {