From 73aebcd0a0bd36a2dd0a3425297236ced9754cf2 Mon Sep 17 00:00:00 2001 From: aditya-K2 Date: Mon, 13 Dec 2021 00:13:16 +0530 Subject: [PATCH] Added Check for / at the end in directory names --- config/config.go | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/config/config.go b/config/config.go index a8b3a77..9a57ff4 100644 --- a/config/config.go +++ b/config/config.go @@ -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 + "/" + } +}