Added Check for / at the end in directory names

This commit is contained in:
aditya-K2 2021-12-13 00:13:16 +05:30
parent 2e1e0938c0
commit 73aebcd0a0
1 changed files with 10 additions and 2 deletions

View File

@ -17,10 +17,10 @@ var (
"ADDITIONAL_PADDING_Y": 16,
"IMAGE_WIDTH_EXTRA_X": -1.5,
"IMAGE_WIDTH_EXTRA_Y": -3.75,
"MUSIC_DIRECTORY": getMusicDirectory() + "/",
"MUSIC_DIRECTORY": CheckDirectoryFmt(getMusicDirectory()),
"PORT": "6600",
"DEFAULT_IMAGE_PATH": "default.jpg",
"CACHE_DIR": USER_CACHE_DIR + "/",
"CACHE_DIR": CheckDirectoryFmt(USER_CACHE_DIR),
}
)
@ -73,3 +73,11 @@ func getMusicDirectory() string {
}
return ""
}
func CheckDirectoryFmt(path string) string {
if strings.HasSuffix(path, "/") {
return path
} else {
return path + "/"
}
}