Skip to content

Commit

Permalink
Only delete old theme XMLs if they exist
Browse files Browse the repository at this point in the history
  • Loading branch information
devblackops committed Nov 17, 2023
1 parent 3570575 commit df4c96c
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions Terminal-Icons/Terminal-Icons.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ $iconThemes = Import-Clixml -Path $moduleRoot/Data/iconThemes.xml
$colorThemes = Import-Clixml -Path $moduleRoot/Data/colorThemes.xml
$colorSequences = Import-Clixml -Path $moduleRoot/Data/colorSequences.xml
$glyphs = Import-Clixml -Path $moduleRoot/Data/glyphs.xml

# Set current settings
$current = Get-CurrentSettings
$current.Themes = @{
Expand All @@ -63,7 +64,9 @@ $current.Themes = @{

# As of 0.12.0, we no longer save the builtin theme files in the user theme folder
('devblackops_color.xml', 'devblackops_light_color.xml', 'devblackops_icon.xml').ForEach({
Remove-Item $userThemePath/$_ -ErrorAction SilentlyContinue
if (Test-Path $userThemePath/$_) {
Remove-Item $userThemePath/$_ -ErrorAction SilentlyContinue
}
})

# TODO: Store the user themes pre-processes to speed things up
Expand All @@ -84,4 +87,4 @@ $current.Themes = @{
Save-Preferences -Preferences $prefs

$formatFile = $IsWindows ? 'Terminal-Icons.format.ps1xml' : 'Terminal-Icons.format_nix.ps1xml'
Update-FormatData -AppendPath ([IO.Path]::Combine($moduleRoot, $formatFile))
Update-FormatData -PrependPath ([IO.Path]::Combine($moduleRoot, $formatFile))

0 comments on commit df4c96c

Please sign in to comment.