MCPcopy Create free account
hub / github.com/astercloud/aster / normalizeDir

Function normalizeDir

pkg/memory/memory.go:219–234  ·  view source on GitHub ↗

normalizeDir 规范化目录路径为 "/xxx/" 形式

(path string)

Source from the content-addressed store, hash-verified

217
218// normalizeDir 规范化目录路径为 "/xxx/" 形式
219func normalizeDir(path string) string {
220 if path == "" {
221 return "/"
222 }
223
224 // 使用 filepath.Clean 处理冗余分隔符,再统一为 Unix 风格
225 cleaned := filepath.ToSlash(filepath.Clean(path))
226
227 if !strings.HasPrefix(cleaned, "/") {
228 cleaned = "/" + cleaned
229 }
230 if !strings.HasSuffix(cleaned, "/") {
231 cleaned += "/"
232 }
233 return cleaned
234}
235
236// resolvePath 将相对名称解析为 memoryPath 下的完整路径
237func (m *Manager) resolvePath(name string) string {

Callers 2

NewWorkingMemoryManagerFunction · 0.85
NewManagerFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected