@@ -20,7 +20,7 @@ internal struct ThemeStorage {
2020 } ( )
2121
2222 private static let bundledThemesDirectory : URL ? = {
23- Bundle . main. resourceURL? . appendingPathComponent ( " Themes " , isDirectory : true )
23+ Bundle . main. resourceURL
2424 } ( )
2525
2626 private static let registryThemesDirectory : URL = {
@@ -40,9 +40,9 @@ internal struct ThemeStorage {
4040 static func loadAllThemes( ) -> [ ThemeDefinition ] {
4141 var themes : [ ThemeDefinition ] = [ ]
4242
43- // Load built-in themes from app bundle
43+ // Load built-in themes from app bundle (files copied flat to Resources/)
4444 if let bundleDir = bundledThemesDirectory {
45- themes. append ( contentsOf: loadThemes ( from: bundleDir, isBuiltIn : true ) )
45+ themes. append ( contentsOf: loadBuiltInThemes ( from: bundleDir) )
4646 }
4747
4848 // If no bundled themes loaded, use compiled presets as fallback
@@ -215,6 +215,21 @@ internal struct ThemeStorage {
215215 }
216216 }
217217
218+ private static func loadBuiltInThemes( from directory: URL ) -> [ ThemeDefinition ] {
219+ let fm = FileManager . default
220+ guard fm. fileExists ( atPath: directory. path) else { return [ ] }
221+
222+ do {
223+ let files = try fm. contentsOfDirectory ( at: directory, includingPropertiesForKeys: nil )
224+ . filter { $0. pathExtension == " json " && $0. lastPathComponent. hasPrefix ( " tablepro. " ) }
225+
226+ return files. compactMap { loadTheme ( from: $0) }
227+ } catch {
228+ logger. error ( " Failed to list built-in themes: \( error) " )
229+ return [ ]
230+ }
231+ }
232+
218233 private static func loadThemes( from directory: URL , isBuiltIn: Bool ) -> [ ThemeDefinition ] {
219234 let fm = FileManager . default
220235 guard fm. fileExists ( atPath: directory. path) else { return [ ] }
0 commit comments