Skip to content

Commit 2a00a65

Browse files
committed
[xcodegen] Add a couple more source file extensions
And handle case differences.
1 parent b612b5e commit 2a00a65

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

utils/swift-xcodegen/Sources/SwiftXcodeGen/Path/FileExtension.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,23 @@
1111
//===----------------------------------------------------------------------===//
1212

1313
public enum FileExtension: String {
14+
case asm
1415
case c
16+
case cc
17+
case cl
1518
case cpp
1619
case def
1720
case gyb
1821
case h
22+
case inc
1923
case m
2024
case md
2125
case mm
2226
case modulemap
2327
case o
28+
case proto
2429
case rst
30+
case s
2531
case swift
2632
case swiftmodule
2733
case td

utils/swift-xcodegen/Sources/SwiftXcodeGen/Path/PathProtocol.swift

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,10 @@ public extension PathProtocol {
7474
func hasExtension(_ exts: FileExtension...) -> Bool {
7575
// Note that querying `.extension` involves re-parsing, so only do it
7676
// once here.
77-
let ext = storage.extension
78-
return exts.contains(where: { ext == $0.rawValue })
77+
guard let ext = storage.extension else { return false }
78+
return exts.contains(where: {
79+
ext.compare($0.rawValue, options: .caseInsensitive) == .orderedSame
80+
})
7981
}
8082

8183
func starts(with other: Self) -> Bool {

0 commit comments

Comments
 (0)