@@ -84,6 +84,13 @@ pub enum SdkSearchLocation {
84
84
/// if available.
85
85
CommandLineTools ,
86
86
87
+ /// Check the paths configured by `xcode-select --switch`.
88
+ ///
89
+ /// This effectively controls whether the Developer Directory resolved by
90
+ /// [DeveloperDirectory::from_xcode_select_paths()] will be searched, if
91
+ /// available.
92
+ XcodeSelectPaths ,
93
+
87
94
/// Invoke `xcode-select` to find a *Developer Directory* to search.
88
95
///
89
96
/// This mechanism is intended as a fallback in case other (pure Rust) mechanisms for locating
@@ -129,6 +136,9 @@ impl Display for SdkSearchLocation {
129
136
Self :: DeveloperDirEnv => f. write_str ( "DEVELOPER_DIR environment variable" ) ,
130
137
Self :: SystemXcode => f. write_str ( "System-installed Xcode application" ) ,
131
138
Self :: CommandLineTools => f. write_str ( "Xcode Command Line Tools installation" ) ,
139
+ Self :: XcodeSelectPaths => {
140
+ f. write_str ( "Internal xcode-select paths (`/var/db/xcode_select_link`)" )
141
+ }
132
142
Self :: XcodeSelect => f. write_str ( "xcode-select" ) ,
133
143
Self :: SystemXcodes => f. write_str ( "All system-installed Xcode applications" ) ,
134
144
Self :: Developer ( dir) => {
@@ -186,6 +196,15 @@ impl SdkSearchLocation {
186
196
Ok ( SdkSearchResolvedLocation :: None )
187
197
}
188
198
}
199
+ Self :: XcodeSelectPaths => {
200
+ if let Some ( dir) = DeveloperDirectory :: from_xcode_select_paths ( ) ? {
201
+ Ok ( SdkSearchResolvedLocation :: PlatformDirectories (
202
+ dir. platforms ( ) ?,
203
+ ) )
204
+ } else {
205
+ Ok ( SdkSearchResolvedLocation :: None )
206
+ }
207
+ }
189
208
Self :: XcodeSelect => Ok ( SdkSearchResolvedLocation :: PlatformDirectories (
190
209
DeveloperDirectory :: from_xcode_select ( ) ?. platforms ( ) ?,
191
210
) ) ,
@@ -275,9 +294,7 @@ pub enum SdkSearchEvent {
275
294
impl Display for SdkSearchEvent {
276
295
fn fmt ( & self , f : & mut Formatter < ' _ > ) -> std:: fmt:: Result {
277
296
match self {
278
- Self :: SearchingLocation ( location) => {
279
- f. write_fmt ( format_args ! ( "searching {location}" ) )
280
- }
297
+ Self :: SearchingLocation ( location) => f. write_fmt ( format_args ! ( "searching {location}" ) ) ,
281
298
Self :: PlatformDirectoryInclude ( path) => f. write_fmt ( format_args ! (
282
299
"searching Platform directory {}" ,
283
300
path. display( )
@@ -383,6 +400,7 @@ impl Default for SdkSearch {
383
400
locations : vec ! [
384
401
SdkSearchLocation :: SdkRootEnv ,
385
402
SdkSearchLocation :: DeveloperDirEnv ,
403
+ SdkSearchLocation :: XcodeSelectPaths ,
386
404
SdkSearchLocation :: SystemXcode ,
387
405
SdkSearchLocation :: CommandLineTools ,
388
406
] ,
@@ -617,9 +635,7 @@ impl SdkSearch {
617
635
if let Some ( cb) = & self . progress_callback {
618
636
cb ( SdkSearchEvent :: SdkFilterExclude (
619
637
sdk_path,
620
- format ! (
621
- "SDK version {sdk_version} < minimum version {min_version}"
622
- ) ,
638
+ format ! ( "SDK version {sdk_version} < minimum version {min_version}" ) ,
623
639
) ) ;
624
640
}
625
641
@@ -630,9 +646,7 @@ impl SdkSearch {
630
646
if let Some ( cb) = & self . progress_callback {
631
647
cb ( SdkSearchEvent :: SdkFilterExclude (
632
648
sdk_path,
633
- format ! (
634
- "Unknown SDK version fails to meet minimum version {min_version}"
635
- ) ,
649
+ format ! ( "Unknown SDK version fails to meet minimum version {min_version}" ) ,
636
650
) ) ;
637
651
}
638
652
@@ -646,9 +660,7 @@ impl SdkSearch {
646
660
if let Some ( cb) = & self . progress_callback {
647
661
cb ( SdkSearchEvent :: SdkFilterExclude (
648
662
sdk_path,
649
- format ! (
650
- "SDK version {sdk_version} > maximum version {max_version}"
651
- ) ,
663
+ format ! ( "SDK version {sdk_version} > maximum version {max_version}" ) ,
652
664
) ) ;
653
665
}
654
666
@@ -660,9 +672,7 @@ impl SdkSearch {
660
672
if let Some ( cb) = & self . progress_callback {
661
673
cb ( SdkSearchEvent :: SdkFilterExclude (
662
674
sdk_path,
663
- format ! (
664
- "Unknown SDK version fails to meet maximum version {max_version}"
665
- ) ,
675
+ format ! ( "Unknown SDK version fails to meet maximum version {max_version}" ) ,
666
676
) ) ;
667
677
}
668
678
0 commit comments