Skip to content

Commit 250271f

Browse files
committed
fixed some unit tests
1 parent 4bd6648 commit 250271f

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

Sources/Workspace/Workspace.swift

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -423,7 +423,9 @@ public class Workspace {
423423

424424
/// The default location of the git repository cache
425425
let repositoriesPath: AbsolutePath = {
426-
let cacheURL = FileManager.default.urls(for: .cachesDirectory, in: .userDomainMask).first!
426+
guard let cacheURL = FileManager.default.urls(for: .cachesDirectory, in: .userDomainMask).first else {
427+
return localFileSystem.homeDirectory.appending(components: ".swiftpm", "repositories")
428+
}
427429
return AbsolutePath(cacheURL.path).appending(components: "org.swift.swiftpm", "repositories")
428430
}()
429431

@@ -590,7 +592,6 @@ extension Workspace {
590592

591593
// These are the things we don't want to remove while cleaning.
592594
let protectedAssets = [
593-
repositoryManager.path,
594595
checkoutsPath,
595596
artifactsPath,
596597
state.path,
@@ -632,6 +633,7 @@ extension Workspace {
632633

633634
repositoryManager.reset()
634635
try? fileSystem.removeFileTree(dataPath)
636+
try? fileSystem.removeFileTree(repositoryManager.path)
635637
}
636638

637639
/// Cancel the active dependency resolution operation.

0 commit comments

Comments
 (0)