ThemeAssetPath returns path of theme; assets, color.ini, theme.js and user.css
(kind string)
| 10 | |
| 11 | // ThemeAssetPath returns path of theme; assets, color.ini, theme.js and user.css |
| 12 | func 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 |
| 41 | func ThemeAllAssetsPath() (string, error) { |
no test coverage detected