MCPcopy Create free account
hub / github.com/53AI/53AIHub / GetDirectoryPath

Method GetDirectoryPath

api/service/directory_manager.go:414–433  ·  view source on GitHub ↗

GetDirectoryPath 获取目录路径

(basePath, relativePath string)

Source from the content-addressed store, hash-verified

412
413// GetDirectoryPath 获取目录路径
414func (dm *DirectoryManager) GetDirectoryPath(basePath, relativePath string) string {
415 if basePath == "" {
416 return "/" + strings.TrimPrefix(relativePath, "/")
417 }
418
419 // 确保basePath以/开头
420 if !strings.HasPrefix(basePath, "/") {
421 basePath = "/" + basePath
422 }
423
424 // 组合路径
425 fullPath := filepath.Join(basePath, relativePath)
426
427 // 确保路径以/开头
428 if !strings.HasPrefix(fullPath, "/") {
429 fullPath = "/" + fullPath
430 }
431
432 return filepath.Clean(fullPath)
433}
434
435func applyFileOriginMeta(file *model.File, originType string, originSource string, originRefID int64) {
436 if file == nil {

Callers 4

CreateDirectoryTreeMethod · 0.95
createDirectoryRecordMethod · 0.95
CreateFileRecordMethod · 0.95
CreateBatchMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected