***** migrations **/ migrateToV1 deletes YAML archive if exists
(ctx context.DnoteCtx)
| 481 | |
| 482 | // migrateToV1 deletes YAML archive if exists |
| 483 | func migrateToV1(ctx context.DnoteCtx) error { |
| 484 | yamlPath := fmt.Sprintf("%s/%s", ctx.Paths.Home, ".dnote-yaml-archived") |
| 485 | ok, err := utils.FileExists(yamlPath) |
| 486 | if err != nil { |
| 487 | return errors.Wrap(err, "checking if yaml file exists") |
| 488 | } |
| 489 | if !ok { |
| 490 | return nil |
| 491 | } |
| 492 | |
| 493 | if err := os.Remove(yamlPath); err != nil { |
| 494 | return errors.Wrap(err, "Failed to delete .dnote archive") |
| 495 | } |
| 496 | |
| 497 | return nil |
| 498 | } |
| 499 | |
| 500 | func migrateToV2(ctx context.DnoteCtx) error { |
| 501 | notePath := fmt.Sprintf("%s/dnote", ctx.Paths.LegacyDnote) |