summaryrefslogtreecommitdiffstats
path: root/helpers
diff options
context:
space:
mode:
Diffstat (limited to 'helpers')
-rw-r--r--helpers/path.go9
1 files changed, 9 insertions, 0 deletions
diff --git a/helpers/path.go b/helpers/path.go
index 29e1e6071..01c452607 100644
--- a/helpers/path.go
+++ b/helpers/path.go
@@ -665,3 +665,12 @@ func FileContainsAny(filename string, subslices [][]byte, fs afero.Fs) (bool, er
func Exists(path string, fs afero.Fs) (bool, error) {
return afero.Exists(fs, path)
}
+
+// AddTrailingSlash adds a trailing Unix styled slash (/) if not already
+// there.
+func AddTrailingSlash(path string) string {
+ if !strings.HasSuffix(path, "/") {
+ path += "/"
+ }
+ return path
+}