mirror of
https://github.com/zyedidia/micro.git
synced 2026-03-18 23:07:13 +09:00
No backups for no name files
This commit is contained in:
@@ -26,7 +26,7 @@ Options: [r]ecover, [i]gnore: `
|
||||
|
||||
// Backup saves the current buffer to ConfigDir/backups
|
||||
func (b *Buffer) Backup(checkTime bool) error {
|
||||
if !b.Settings["backup"].(bool) {
|
||||
if !b.Settings["backup"].(bool) || b.Path == "" {
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -79,7 +79,7 @@ func (b *Buffer) Backup(checkTime bool) error {
|
||||
|
||||
// RemoveBackup removes any backup file associated with this buffer
|
||||
func (b *Buffer) RemoveBackup() {
|
||||
if !b.Settings["backup"].(bool) {
|
||||
if !b.Settings["backup"].(bool) || b.Path == "" {
|
||||
return
|
||||
}
|
||||
f := config.ConfigDir + "/backups/" + util.EscapePath(b.AbsPath)
|
||||
|
||||
@@ -204,7 +204,7 @@ func NewBuffer(r io.Reader, size int64, path string, startcursor Loc, btype BufT
|
||||
b.SharedBuffer = new(SharedBuffer)
|
||||
b.Type = btype
|
||||
|
||||
if b.Settings["backup"].(bool) {
|
||||
if b.Settings["backup"].(bool) && len(path) > 0 {
|
||||
backupfile := config.ConfigDir + "/backups/" + EscapePath(absPath)
|
||||
if info, err := os.Stat(backupfile); err == nil {
|
||||
backup, err := os.Open(backupfile)
|
||||
|
||||
Reference in New Issue
Block a user