MCPcopy
hub / github.com/spicetify/cli / ThemeAssetPath

Function ThemeAssetPath

src/cmd/path.go:12–38  ·  view source on GitHub ↗

ThemeAssetPath returns path of theme; assets, color.ini, theme.js and user.css

(kind string)

Source from the content-addressed store, hash-verified

10
11// ThemeAssetPath returns path of theme; assets, color.ini, theme.js and user.css
12func ThemeAssetPath(kind string) (string, error) {
13 InitSetting()
14
15 if kind == "root" {
16 return filepath.Join(utils.GetExecutableDir(), "Themes"), nil
17 } else if len(themeFolder) == 0 {
18 return "", errors.New(`config "current_theme" is blank`)
19 }
20
21 if kind == "folder" {
22 return themeFolder, nil
23 } else if kind == "color" {
24 color := filepath.Join(themeFolder, "color.ini")
25 return color, nil
26 } else if kind == "css" {
27 css := filepath.Join(themeFolder, "user.css")
28 return css, nil
29 } else if kind == "js" {
30 js := filepath.Join(themeFolder, "theme.js")
31 return js, nil
32 } else if kind == "assets" {
33 assets := filepath.Join(themeFolder, "assets")
34 return assets, nil
35 }
36
37 return "", errors.New(`unrecognized theme assets kind. only "root", "folder", "color", "css", "js" or "assets" is valid`)
38}
39
40// ThemeAllAssetsPath returns paths of all theme's assets
41func ThemeAllAssetsPath() (string, error) {

Callers 1

mainFunction · 0.92

Calls 2

GetExecutableDirFunction · 0.92
InitSettingFunction · 0.85

Tested by

no test coverage detected