Moving utils.go to utils package

This commit is contained in:
aditya-K2
2021-12-13 01:35:40 +05:30
parent bc3e5b6741
commit 9b60cbc98e
9 changed files with 79 additions and 69 deletions

View File

@@ -6,6 +6,7 @@ import (
"os"
"strings"
"github.com/aditya-K2/goMP/utils"
"github.com/spf13/viper"
)
@@ -17,10 +18,10 @@ var (
"ADDITIONAL_PADDING_Y": 16,
"IMAGE_WIDTH_EXTRA_X": -1.5,
"IMAGE_WIDTH_EXTRA_Y": -3.75,
"MUSIC_DIRECTORY": CheckDirectoryFmt(getMusicDirectory()),
"MUSIC_DIRECTORY": utils.CheckDirectoryFmt(getMusicDirectory()),
"PORT": "6600",
"DEFAULT_IMAGE_PATH": "default.jpg",
"CACHE_DIR": CheckDirectoryFmt(USER_CACHE_DIR),
"CACHE_DIR": utils.CheckDirectoryFmt(USER_CACHE_DIR),
}
)
@@ -73,11 +74,3 @@ func getMusicDirectory() string {
}
return ""
}
func CheckDirectoryFmt(path string) string {
if strings.HasSuffix(path, "/") {
return path
} else {
return path + "/"
}
}