XhmikosR / notepad2-mod

LOOKING FOR DEVELOPERS - Notepad2-mod, a Notepad2 fork, a fast and light-weight Notepad-like text editor with syntax highlighting
https://xhmikosr.github.io/notepad2-mod/
Other
1.45k stars 270 forks source link

Built in UAC elevation request #8

Open XhmikosR opened 12 years ago

XhmikosR commented 12 years ago

This is Issue 50 moved from a Google Code project. Added by 2011-10-13T16:27:44.000Z by dani...@gmail.com. Please review that bug for more context and additional comments, but update this bug.

Original labels: Type-Enhancement, Priority-Medium

Original description

Do to UAC protection in windows editing files in system folders requires administrator permissions. It's quite anoying to have to close notepad2, open it as administrator, reopen the file, edit it again and finally be able to save.

So I was wondering if it would not be possible to add a built in UAC elevation request on save or as maybe a "edit as administrator" option to aliviate the issue.
QWp6t commented 11 years ago

From Notepad2 FAQ:

There may be an easier way to save files with Administrator privileges. The principle of this method would be to create a temporary file, and then use a Win32 API file operation function with partial UAC elevation support to copy the temporary file over the original. However, this would break hardlinks, so that's why it's a design decision not to implement this method in Notepad2.

So in lieu of an "easier way to save files with Administrator privileges," he recommends using /u (or /n /u as the case may be) and copy/paste your text.

Seemed like that might be relevant to this issue.

josenicomaia commented 9 years ago

Incrementing this:

This can solve this feature request.

apex-hughin commented 9 years ago

If save fails because of missing rights save a temporary diff of the buffer and the file. Display a dialog that allows you to open the file in an elevated Notepad2 and apply the temporary diff. Add an 'Open elevated' feature in the file open dialogue, maybe. This would be in addition to the menu entry suggested by @josenicomaia . This also prevents the hardlink breaking issue with copying a temporary file. Disadvantage: basic support for diff-ing required.

hmemcpy commented 8 years ago

I realize this is an old issue, but I implemented this much-needed feature over the weekend (#154). It works by saving a temp file before restarting, and then loading the contents from that temp file, but keeping the original filename. For this, I added a new command line parameter, /buffer, allowing specifying path to the filename with the contents of the text buffer.

Would be awesome if this gets merged :)

klonos commented 8 years ago

Thanx @hmemcpy :+1: