File tree Expand file tree Collapse file tree 2 files changed +33
-10
lines changed
Sources/VariantsCore/Custom Types Expand file tree Collapse file tree 2 files changed +33
-10
lines changed Original file line number Diff line number Diff line change @@ -19,11 +19,23 @@ struct TemplateDirectory {
1919 " ./Templates "
2020 ]
2121 ) throws {
22- let firstDirectory = directories
23- . map ( Path . init ( stringLiteral: ) )
24- . first ( where: \. exists)
25-
26- guard let path = firstDirectory else {
22+
23+ var templateDirectories = directories. map ( Path . init ( stringLiteral: ) )
24+
25+ if let variantsInstallationPath = try ? Bash (
26+ " which " ,
27+ arguments: " variants "
28+ ) . capture ( ) {
29+ templateDirectories. append (
30+ Path ( variantsInstallationPath. replacingOccurrences (
31+ of: " /bin/variants " ,
32+ with: " /lib/variants/templates "
33+ ) )
34+ )
35+ }
36+
37+ let firstFoundDirectory = templateDirectories. first ( where: \. exists)
38+ guard let path = firstFoundDirectory else {
2739 let dirs = directories. joined ( separator: " or " )
2840 throw RuntimeError ( " Templates folder not found in \( dirs) " )
2941 }
Original file line number Diff line number Diff line change @@ -19,11 +19,22 @@ struct UtilsDirectory {
1919 " ./utils "
2020 ]
2121 ) throws {
22- let firstDirectory = directories
23- . map ( Path . init ( stringLiteral: ) )
24- . first ( where: \. exists)
25-
26- guard let path = firstDirectory else {
22+ var utilsDirectories = directories. map ( Path . init ( stringLiteral: ) )
23+
24+ if let variantsInstallationPath = try ? Bash (
25+ " which " ,
26+ arguments: " variants "
27+ ) . capture ( ) {
28+ utilsDirectories. append (
29+ Path ( variantsInstallationPath. replacingOccurrences (
30+ of: " /bin/variants " ,
31+ with: " /lib/variants/utils "
32+ ) )
33+ )
34+ }
35+
36+ let firstFoundDirectory = utilsDirectories. first ( where: \. exists)
37+ guard let path = firstFoundDirectory else {
2738 let dirs = directories. joined ( separator: " or " )
2839 throw RuntimeError ( " Utils folder not found in \( dirs) " )
2940 }
You can’t perform that action at this time.
0 commit comments