MCPcopy Index your code
hub / github.com/dnote/dnote / backupDnoteDir

Function backupDnoteDir

pkg/cli/migrate/legacy.go:175–184  ·  view source on GitHub ↗

backupDnoteDir backs up the dnote directory to a temporary backup directory

(ctx context.DnoteCtx)

Source from the content-addressed store, hash-verified

173
174// backupDnoteDir backs up the dnote directory to a temporary backup directory
175func backupDnoteDir(ctx context.DnoteCtx) error {
176 srcPath := fmt.Sprintf("%s/.dnote", ctx.Paths.Home)
177 tmpPath := fmt.Sprintf("%s/%s", ctx.Paths.Home, backupDirName)
178
179 if err := utils.CopyDir(srcPath, tmpPath); err != nil {
180 return errors.Wrap(err, "Failed to copy the .dnote directory")
181 }
182
183 return nil
184}
185
186func restoreBackup(ctx context.DnoteCtx) error {
187 var err error

Callers 1

performMigrationFunction · 0.85

Calls 1

CopyDirFunction · 0.92

Tested by

no test coverage detected