Skip to content

Commit ec8bb7c

Browse files
authored
Merge pull request zyedidia#3866 from niten94/hide-sudo-prompt-win
- Disable sudo save prompt on Windows - Add micro.exe to .gitignore
2 parents ad24089 + dcdddc1 commit ec8bb7c

File tree

3 files changed

+6
-3
lines changed

3 files changed

+6
-3
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
.DS_Store
22

33
micro
4+
micro.exe
45
!cmd/micro
56
binaries/
67
tmp.sh

internal/action/actions.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1038,6 +1038,11 @@ func (h *BufPane) saveBufToFile(filename string, action string, callback func())
10381038
err := h.Buf.SaveAs(filename)
10391039
if err != nil {
10401040
if errors.Is(err, fs.ErrPermission) {
1041+
if runtime.GOOS == "windows" {
1042+
InfoBar.Error("Permission denied. Save with sudo not supported on Windows")
1043+
return true
1044+
}
1045+
10411046
saveWithSudo := func() {
10421047
err = h.Buf.SaveAsWithSudo(filename)
10431048
if err != nil {

internal/buffer/save.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -246,9 +246,6 @@ func (b *Buffer) saveToFile(filename string, withSudo bool, autoSave bool) error
246246
if b.Type.Scratch {
247247
return errors.New("Cannot save scratch buffer")
248248
}
249-
if withSudo && runtime.GOOS == "windows" {
250-
return errors.New("Save with sudo not supported on Windows")
251-
}
252249

253250
if !autoSave && b.Settings["rmtrailingws"].(bool) {
254251
for i, l := range b.lines {

0 commit comments

Comments
 (0)