MCPcopy Create free account
hub / github.com/OpenListTeam/OpenList / SymlinkOrCopyFile

Function SymlinkOrCopyFile

pkg/utils/file.go:77–85  ·  view source on GitHub ↗

SymlinkOrCopyFile symlinks a file or copy if symlink failed

(src, dst string)

Source from the content-addressed store, hash-verified

75
76// SymlinkOrCopyFile symlinks a file or copy if symlink failed
77func SymlinkOrCopyFile(src, dst string) error {
78 if err := CreateNestedDirectory(filepath.Dir(dst)); err != nil {
79 return err
80 }
81 if err := os.Symlink(src, dst); err != nil {
82 return CopyFile(src, dst)
83 }
84 return nil
85}
86
87// Exists determine whether the file exists
88func Exists(name string) bool {

Callers

nothing calls this directly

Calls 3

CreateNestedDirectoryFunction · 0.85
SymlinkMethod · 0.80
CopyFileFunction · 0.70

Tested by

no test coverage detected