backupDnoteDir backs up the dnote directory to a temporary backup directory
(ctx context.DnoteCtx)
| 173 | |
| 174 | // backupDnoteDir backs up the dnote directory to a temporary backup directory |
| 175 | func 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 | |
| 186 | func restoreBackup(ctx context.DnoteCtx) error { |
| 187 | var err error |
no test coverage detected