GetDirectoryPath 获取目录路径
(basePath, relativePath string)
| 412 | |
| 413 | // GetDirectoryPath 获取目录路径 |
| 414 | func (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 | |
| 435 | func applyFileOriginMeta(file *model.File, originType string, originSource string, originRefID int64) { |
| 436 | if file == nil { |
no outgoing calls
no test coverage detected