MCPcopy Create free account
hub / github.com/PostHog/duckgres / copyFile

Function copyFile

server/server.go:1154–1181  ·  view source on GitHub ↗
(srcPath, dstPath string, mode os.FileMode)

Source from the content-addressed store, hash-verified

1152 }
1153 dstPath := filepath.Join(dstRoot, rel)
1154
1155 info, err := os.Lstat(path)
1156 if err != nil {
1157 return err
1158 }
1159 if walkInfo != nil {
1160 info = walkInfo
1161 }
1162 if info.IsDir() {
1163 return os.MkdirAll(dstPath, 0o750)
1164 }
1165 if info.Mode()&os.ModeSymlink != 0 {
1166 return nil
1167 }
1168 if err := os.MkdirAll(filepath.Dir(dstPath), 0o750); err != nil {
1169 return err
1170 }
1171 if _, err := os.Stat(dstPath); err == nil {
1172 if !shouldRefreshBundledExtension(path) {
1173 return nil
1174 }
1175 } else if !errors.Is(err, os.ErrNotExist) {
1176 return err
1177 }
1178
1179 return copyFile(path, dstPath, info.Mode().Perm())
1180 })
1181}
1182
1183// shouldRefreshBundledExtension returns true for bundled extensions whose
1184// on-disk copy in DataDir/extensions/v<ver>/<platform>/ must be overwritten

Callers 1

seedBundledExtensionsFunction · 0.85

Calls 4

RemoveMethod · 0.80
CloseMethod · 0.65
NameMethod · 0.65
OpenMethod · 0.45

Tested by

no test coverage detected