File tree Expand file tree Collapse file tree
Sources/FluidAudio/TextToSpeech/Kokoro/Assets/Lexicon Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -69,28 +69,19 @@ final class EspeakG2P {
6969 }
7070
7171 private static func frameworkBundledDataPath( ) -> URL ? {
72- // ESpeakNG.xcframework has espeak-ng-data.bundle embedded
73- guard let frameworkBundle = Bundle ( identifier: " com.fluidaudio.ESpeakNG " ) else {
74- return nil
75- }
76-
77- guard
78- let bundleURL = frameworkBundle. url (
79- forResource: " espeak-ng-data " ,
80- withExtension: " bundle "
81- )
82- else {
83- return nil
84- }
85-
86- let dataDir = bundleURL. appendingPathComponent ( " espeak-ng-data " )
87- let voicesPath = dataDir. appendingPathComponent ( " voices " )
88-
89- guard FileManager . default. fileExists ( atPath: voicesPath. path) else {
90- return nil
72+ // Try to find espeak-ng-data.bundle in all loaded bundles
73+ for bundle in Bundle . allBundles {
74+ if let bundleURL = bundle. url ( forResource: " espeak-ng-data " , withExtension: " bundle " ) {
75+ let dataDir = bundleURL. appendingPathComponent ( " espeak-ng-data " )
76+ let voicesPath = dataDir. appendingPathComponent ( " voices " )
77+
78+ if FileManager . default. fileExists ( atPath: voicesPath. path) {
79+ return dataDir
80+ }
81+ }
9182 }
9283
93- return dataDir
84+ return nil
9485 }
9586
9687 static func isDataAvailable( ) -> Bool {
You can’t perform that action at this time.
0 commit comments