mirror of
https://github.com/zyedidia/micro.git
synced 2026-02-04 14:10:23 +09:00
Merge pull request #3866 from niten94/hide-sudo-prompt-win
- Disable sudo save prompt on Windows - Add micro.exe to .gitignore
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -1,6 +1,7 @@
|
|||||||
.DS_Store
|
.DS_Store
|
||||||
|
|
||||||
micro
|
micro
|
||||||
|
micro.exe
|
||||||
!cmd/micro
|
!cmd/micro
|
||||||
binaries/
|
binaries/
|
||||||
tmp.sh
|
tmp.sh
|
||||||
|
|||||||
@@ -1038,6 +1038,11 @@ func (h *BufPane) saveBufToFile(filename string, action string, callback func())
|
|||||||
err := h.Buf.SaveAs(filename)
|
err := h.Buf.SaveAs(filename)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if errors.Is(err, fs.ErrPermission) {
|
if errors.Is(err, fs.ErrPermission) {
|
||||||
|
if runtime.GOOS == "windows" {
|
||||||
|
InfoBar.Error("Permission denied. Save with sudo not supported on Windows")
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
saveWithSudo := func() {
|
saveWithSudo := func() {
|
||||||
err = h.Buf.SaveAsWithSudo(filename)
|
err = h.Buf.SaveAsWithSudo(filename)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
@@ -246,9 +246,6 @@ func (b *Buffer) saveToFile(filename string, withSudo bool, autoSave bool) error
|
|||||||
if b.Type.Scratch {
|
if b.Type.Scratch {
|
||||||
return errors.New("Cannot save scratch buffer")
|
return errors.New("Cannot save scratch buffer")
|
||||||
}
|
}
|
||||||
if withSudo && runtime.GOOS == "windows" {
|
|
||||||
return errors.New("Save with sudo not supported on Windows")
|
|
||||||
}
|
|
||||||
|
|
||||||
if !autoSave && b.Settings["rmtrailingws"].(bool) {
|
if !autoSave && b.Settings["rmtrailingws"].(bool) {
|
||||||
for i, l := range b.lines {
|
for i, l := range b.lines {
|
||||||
|
|||||||
Reference in New Issue
Block a user