Backup in beta release

This commit is contained in:
Sung Won Cho 2018-01-06 18:08:02 +11:00
commit 9043dbe495

View file

@ -17,7 +17,7 @@ import (
const (
// Version is the current version of dnote
Version = "0.2.0-beta"
Version = "0.2.0-alpha"
// TimestampFilename is the name of the file containing upgrade info
TimestampFilename = "timestamps"
@ -450,6 +450,11 @@ func MigrateToDnoteDir(ctx infra.DnoteCtx) error {
return errors.Wrap(err, "Failed to make temporary .dnote directory")
}
// In the beta release for v0.2, backup user's .dnote
if err := utils.CopyFile(oldDnotePath, fmt.Sprintf("%s/dnote-bak-5cdde2e83", homeDir)); err != nil {
return errors.Wrap(err, "Failed to back up the old .dnote file")
}
if err := os.Rename(oldDnotePath, fmt.Sprintf("%s/dnote", temporaryDirPath)); err != nil {
return errors.Wrap(err, "Failed to move .dnote file")
}