Skip to content

Commit edd3056

Browse files
committed
Fix cache checking bug
1 parent 934eea4 commit edd3056

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

Sources/ScriptingCore/utils.swift

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public func resolveFilePath(_ path: String) -> AbsolutePath? {
4747
guard let cwd = localFileSystem.currentWorkingDirectory else {
4848
return nil
4949
}
50-
absolutePath = AbsolutePath(cwd, path)
50+
absolutePath = AbsolutePath(path, relativeTo: cwd)
5151
}
5252
guard localFileSystem.isFile(absolutePath) else {
5353
return nil
@@ -117,8 +117,9 @@ public func checkAndPerformCache(for file: String, at dirPath: AbsolutePath) thr
117117
return (productName, cacheDirPath)
118118
} else {
119119
// Check if the specified cache exists.
120-
let cacheDirPath = dirPath.appending(component: file)
121-
guard localFileSystem.isDirectory(cacheDirPath) else {
120+
guard !file.contains("/"),
121+
case let cacheDirPath = dirPath.appending(component: file),
122+
localFileSystem.isDirectory(cacheDirPath) else {
122123
throw ScriptError.fileNotFound(file)
123124
}
124125
// Drop the hash suffix.

Tests/CommandsTests/ScriptToolTests.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ final class ScriptToolTests: XCTestCase {
4949
_ = try run(pathString)
5050
XCTFail("Unexpected success")
5151
} catch SwiftPMProductError.executionFailure(_, _, let stderr) {
52-
XCTExpectFailure() // FIXME: Seems an implementation bug of TSC?
5352
XCTAssertEqual(stderr, "error: \(pathString) doesn't exist\n")
5453
}
5554
}

0 commit comments

Comments
 (0)