@@ -19,14 +19,18 @@ extension SymbolGraph.Symbol {
1919 let identifier = SymbolGraph . Symbol. Identifier ( precise: " $snippet__ \( moduleName) . \( basename) " , interfaceLanguage: " swift " )
2020 let names = SymbolGraph . Symbol. Names. init ( title: basename, navigator: nil , subHeading: nil , prose: nil )
2121
22- var pathComponents = snippet. sourceFile. absoluteURL. deletingPathExtension ( ) . pathComponents [ ... ]
22+ var pathComponents = Array ( snippet. sourceFile. absoluteURL. deletingPathExtension ( ) . pathComponents [ ... ] )
2323
2424 guard let snippetsPathComponentIndex = pathComponents. firstIndex ( where: {
2525 $0 == " Snippets "
2626 } ) else {
2727 throw SnippetExtractCommand . ArgumentError. snippetNotContainedInSnippetsDirectory ( snippet. sourceFile)
2828 }
29- pathComponents = pathComponents [ snippetsPathComponentIndex... ]
29+
30+ // In theory, there may be differently named snippet root directories in the future.
31+ // Replace that path component with the standardized `Snippets`.
32+ pathComponents. replaceSubrange ( pathComponents. startIndex... snippetsPathComponentIndex,
33+ with: CollectionOfOne ( " Snippets " ) )
3034
3135 let docComment = SymbolGraph . LineList ( snippet. explanation
3236 . split ( separator: " \n " , maxSplits: Int . max, omittingEmptySubsequences: false )
@@ -39,7 +43,7 @@ extension SymbolGraph.Symbol {
3943
4044 self . init ( identifier: identifier,
4145 names: names,
42- pathComponents: [ " Snippets " ] + Array ( pathComponents) ,
46+ pathComponents: pathComponents,
4347 docComment: docComment,
4448 accessLevel: accessLevel,
4549 kind: kind,
0 commit comments