MCPcopy Create free account
hub / github.com/OpenAtomFoundation/SmartIDE / stripTrailingSlash

Function stripTrailingSlash

cli/pkg/k8s/filespec.go:126–134  ·  view source on GitHub ↗

strips trailing slash (if any) both unix and windows style

(file string)

Source from the content-addressed store, hash-verified

124
125// strips trailing slash (if any) both unix and windows style
126func stripTrailingSlash(file string) string {
127 if len(file) == 0 {
128 return file
129 }
130 if file != "/" && strings.HasSuffix(string(file[len(file)-1]), "/") {
131 return file[:len(file)-1]
132 }
133 return file
134}
135
136func stripLeadingSlash(file string) string {
137 // tar strips the leading '/' and '\' if it's there, so we will too

Callers 2

newLocalPathFunction · 0.85
newRemotePathFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected