Skip to content

Commit edc8c29

Browse files
committed
Check if to include pro package with a configuration file
1 parent 46d91fb commit edc8c29

File tree

3 files changed

+18
-6
lines changed

3 files changed

+18
-6
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,3 +133,4 @@ Python/site-packages/*
133133

134134
Python/VERSIONS
135135
Copilot for Xcode Plus.xcworkspace
136+
PLUS

Core/Package.swift

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -405,14 +405,18 @@ func isProIncluded(file: StaticString = #file) -> Bool {
405405
let rootURL = fileURL
406406
.deletingLastPathComponent()
407407
.deletingLastPathComponent()
408-
let folderURL = rootURL.appendingPathComponent("Pro")
409-
if !FileManager.default.fileExists(atPath: folderURL.path) {
408+
let confURL = rootURL.appendingPathComponent("PLUS")
409+
if !FileManager.default.fileExists(atPath: confURL.path) {
410410
return false
411411
}
412-
let packageManifestURL = folderURL.appendingPathComponent("Package.swift")
413-
if !FileManager.default.fileExists(atPath: packageManifestURL.path) {
412+
do {
413+
let content = String(
414+
data: try Data(contentsOf: confURL),
415+
encoding: .utf8
416+
)
417+
return content?.hasPrefix("YES") ?? false
418+
} catch {
414419
return false
415420
}
416-
return true
417421
}
418422

Core/Sources/ChatService/AllContextCollector.swift

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,19 @@ import ActiveDocumentChatContextCollector
22
import ChatContextCollector
33
import SystemInfoChatContextCollector
44
import WebChatContextCollector
5+
#if canImport(ProChatContextCollectors)
56
import ProChatContextCollectors
6-
77
let allContextCollectors: [any ChatContextCollector] = [
88
SystemInfoChatContextCollector(),
99
ActiveDocumentChatContextCollector(),
1010
WebChatContextCollector(),
1111
ProChatContextCollectors(),
1212
]
13+
#else
14+
let allContextCollectors: [any ChatContextCollector] = [
15+
SystemInfoChatContextCollector(),
16+
ActiveDocumentChatContextCollector(),
17+
WebChatContextCollector(),
18+
]
19+
#endif
1320

0 commit comments

Comments
 (0)