Skip to content

Commit 6cd3ad9

Browse files
fix: Linux compat — conditional CryptoKit import + long line
- Add swift-crypto as explicit PVPrimitives dependency so `import Crypto` works on Linux (CryptoKit is Apple-only; SHA256 API is identical) - Guard import with `#if canImport(CryptoKit)` in RomFileProviderVirtualPath.swift - Split overlong switch case in FileProviderItem.contentType (>200 chars) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 834c353 commit 6cd3ad9

File tree

4 files changed

+17
-31
lines changed

4 files changed

+17
-31
lines changed

Extensions/ROM File Provider/FileProviderItem.swift

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,10 @@ final class FileProviderItem: NSObject, NSFileProviderItem {
266266

267267
var contentType: UTType {
268268
switch kind {
269-
case .root, .categoryFolder, .systemFolder, .publisherFolder, .publisherAllGamesFolder, .publisherSystemFolder, .yearFolder, .regionFolder, .ratingFolder, .saveStateGameFolder, .screenshotGameFolder:
269+
case .root, .categoryFolder, .systemFolder,
270+
.publisherFolder, .publisherAllGamesFolder, .publisherSystemFolder,
271+
.yearFolder, .regionFolder, .ratingFolder,
272+
.saveStateGameFolder, .screenshotGameFolder:
270273
return .folder
271274
case .gameFile(let game, let romURL), .symlinkToGame(let game, let romURL, _, _, _):
272275
let ext = romURL?.pathExtension ?? ""

PVPrimitives/Package.resolved

Lines changed: 1 addition & 28 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

PVPrimitives/Package.swift

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,19 @@ let package = Package(
3232
.package(
3333
name: "PVHashing",
3434
path: "../PVHashing"
35-
)
35+
),
36+
.package(url: "https://github.com/apple/swift-crypto.git", from: "3.0.0")
3637
],
3738

3839
targets: [
3940
.target(
4041
name: "PVPrimitives",
41-
dependencies: ["PVSupport", "PVLogging", "PVHashing"]
42+
dependencies: [
43+
"PVSupport",
44+
"PVLogging",
45+
"PVHashing",
46+
.product(name: "Crypto", package: "swift-crypto")
47+
]
4248
),
4349
// MARK: ------------ Systems ------------
4450
.target(

PVPrimitives/Sources/PVPrimitives/RomFileProviderVirtualPath.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,11 @@
55
// Identifier strings and encoding for the ROM File Provider virtual hierarchy.
66
//
77

8+
#if canImport(CryptoKit)
89
import CryptoKit
10+
#else
11+
import Crypto
12+
#endif
913
import Foundation
1014

1115
/// Root category folders under the file provider root (each maps to a stable `NSFileProviderItemIdentifier` raw value).

0 commit comments

Comments
 (0)