Ignore theme names that cannot be resolved

This commit is contained in:
Kevin Sawicki
2013-10-02 11:24:24 -07:00
parent a3ee15e584
commit 5de21e2cd7
2 changed files with 8 additions and 2 deletions

View File

@@ -23,6 +23,10 @@ describe "ThemeManager", ->
expect(paths[0]).toContain 'atom-dark-ui'
expect(paths[1]).toContain 'atom-light-ui'
it "ignores themes that cannot be resolved to a directory", ->
config.set('core.themes', ['definitely-not-a-theme'])
expect(-> themeManager.getImportPaths()).not.toThrow()
describe "when the core.themes config value changes", ->
it "add/removes stylesheets to reflect the new config value", ->
themeManager.on 'reloaded', reloadHandler = jasmine.createSpy()

View File

@@ -107,8 +107,10 @@ class ThemeManager
if @activeThemes.length > 0
themePaths = (theme.getStylesheetsPath() for theme in @activeThemes when theme)
else
themeNames = config.get('core.themes')
themePaths = (path.join(@resolveThemePath(themeName), AtomPackage.stylesheetsDir) for themeName in themeNames)
themePaths = []
for themeName in config.get('core.themes') ? []
if themePath = @resolveThemePath(themeName)
themePaths.push(path.join(themePath, AtomPackage.stylesheetsDir))
themePath for themePath in themePaths when fsUtils.isDirectorySync(themePath)