MCPcopy
hub / github.com/pocketbase/pocketbase / TempDirClone

Function TempDirClone

tests/app.go:816–828  ·  view source on GitHub ↗

TempDirClone creates a new temporary directory copy from the provided directory path. It is the caller's responsibility to call `os.RemoveAll(tempDir)` when the directory is no longer needed!

(dirToClone string)

Source from the content-addressed store, hash-verified

814// It is the caller's responsibility to call `os.RemoveAll(tempDir)`
815// when the directory is no longer needed!
816func TempDirClone(dirToClone string) (string, error) {
817 tempDir, err := os.MkdirTemp("", "pb_test_*")
818 if err != nil {
819 return "", err
820 }
821
822 // copy everything from testDataDir to tempDir
823 if err := copyDir(dirToClone, tempDir); err != nil {
824 return "", err
825 }
826
827 return tempDir, nil
828}
829
830// -------------------------------------------------------------------
831// Helpers

Callers 1

NewTestAppWithConfigFunction · 0.85

Calls 1

copyDirFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…