edenzik / macvim

Automatically exported from code.google.com/p/macvim
0 stars 0 forks source link

Feature request : Authentication dialog on saving to unwritable files #174

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
From an unprivileged user account, in the Terminal:

$ mvim /etc/hosts

Make changes

:w!

What is the expected output? What do you see instead?

Would be great if MacVim popped up an authentication dialog to ask for 
administrator privileges so that 
it can continue with the file save.

Instead, we get "Can't open file for writing"

What version of MacVim and OS X are you using
Snapshot 45, 10.5.6 Intel

Please provide any additional information below.
I'm missing TextMate's implementation of this - 
http://img145.imageshack.us/img145/8049/picture3ef5.png

Original issue reported on code.google.com by jdelStro...@gmail.com on 29 Apr 2009 at 2:26

GoogleCodeExporter commented 9 years ago
That sounds like a nice feature.  Unfortunately I don't know how it could be 
implemented.  It may work to use AuthorizationExecuteWithPrivileges() to open a 
file and write through the pipe that function returns, but I don't 
know if this is the "right" thing to do or if it would even work.

Any ideas?  I wonder how TextMate does it?

A patch would be welcome as always...

Original comment by bjorn.winckler@gmail.com on 30 Apr 2009 at 9:46

GoogleCodeExporter commented 9 years ago
I'll look into it.  I'm totally unfamiliar with the vim codebase, so no 
guarantees, but I'll see what I can do...

Original comment by jdelStro...@gmail.com on 30 Apr 2009 at 9:56

GoogleCodeExporter commented 9 years ago
The relevant code which tries to write to the file in Vim is inside 
src/fileio.c around line 4110 (the while loop 
around that code, you can also search for "E212").

Original comment by bjorn.winckler@gmail.com on 30 Apr 2009 at 9:59