create if file not exists

This commit is contained in:
lionsoul2014 2026-04-24 16:14:45 +08:00
parent c314ef54ca
commit aab908c923
1 changed files with 1 additions and 1 deletions

View File

@ -378,7 +378,7 @@ func (e *Editor) SaveToFile(dstFile string) error {
return fmt.Errorf("nothing changed")
}
dstHandle, err := os.OpenFile(dstFile, os.O_WRONLY|os.O_TRUNC, 0644)
dstHandle, err := os.OpenFile(dstFile, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0644)
if err != nil {
return err
}