Skip to content

Commit 6d1f058

Browse files
Dharam DhurandharDharam Dhurandhar
Dharam Dhurandhar
authored and
Dharam Dhurandhar
committed
Xcode Theme installation script upgrade
1 parent 153fb46 commit 6d1f058

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

β€ŽSources/XcodeTheme/main.swift

+12-5
Original file line numberDiff line numberDiff line change
@@ -25,16 +25,23 @@ if !fontsFolder.containsFile(named: "SourceCodePro-Regular.ttf") {
2525

2626
print("🎨 Installing Xcode theme...")
2727

28-
let themeURL = URL(fileURLWithPath: #file.replacingOccurrences(of: "Sources/XcodeTheme/main.swift", with: "SundellsColors.xccolortheme"))
29-
let themeData = try Data(contentsOf: themeURL)
28+
// Navigate to the Themes folder
29+
let themesFolder = try Folder.current.subfolder(named: "Themes")
30+
31+
// Get all .xccolortheme files in the Themes folder
32+
let themeFiles = themesFolder.files.filter { $0.extension == "xccolortheme" }
3033

3134
let xcodeFolder = try Folder.home.subfolder(at: "Library/Developer/Xcode")
3235
let userDataFolder = try xcodeFolder.createSubfolderIfNeeded(withName: "UserData")
3336
let themeFolder = try userDataFolder.createSubfolderIfNeeded(withName: "FontAndColorThemes")
3437

35-
let themeFile = try themeFolder.createFile(named: "SundellsColors.xccolortheme")
36-
try themeFile.write(themeData)
38+
for themeFile in themeFiles {
39+
let themeData = try themeFile.read()
40+
let themeDestination = try themeFolder.createFile(named: themeFile.name)
41+
try themeDestination.write(themeData)
42+
print("πŸŽ‰ \(themeFile.name) successfully installed")
43+
}
3744

3845
print("")
39-
print("πŸŽ‰ Sundell's Colors successfully installed")
46+
print("πŸŽ‰ Xcode's Themes successfully installed")
4047
print("πŸ‘ Select it in Xcode's preferences to start using it (you may have to restart Xcode first)")

0 commit comments

Comments
Β (0)