Watch File Change feature enhancement

English main discussion
Post Reply
  • Author
  • Message
Offline
Posts: 21
Joined: Mon Mar 14, 2011 1:27 pm

Watch File Change feature enhancement

Post by danf84 »

Hello,

Could you enhance the Watch File Change feature as follows:
If a change has been made to the file externally, and the file has also been modified by the user, show a different message box or if the user selects to reload the file, tell them that the file has also been changed and the changes will be lost.

For example:

"C:\Temp\myFile.txt" has been modified outside.
Do you want to reopen it?"
Then if the user selects "Yes", follow the normal protocol, that is, "Do you want to save changes?" Because right now, AkelPad simply skips that.

Kind regards,

Dan

Offline
Posts: 147
Joined: Fri Feb 08, 2008 6:41 pm
Location: British Columbia, Canada

External changes to file detected

Post by Surveyor »

Dan,

I sort of see where you are going with the request, but I don't understand how it might work. For example:
  1. You open myFile.txt with AkelPad and make changes. Changes are not yet saved, so are in memory only.
  2. myFile.txt (same file, on disk!) is modified by unknown means. This could be you editing it in Notepad, or another program operating on that file as output, etc. Actual disk file is saved (i.e. modified on disk).
  3. AkelPad detects the change (archive bit set, size/date changed, or ?) and reports that the disk file you have loaded is now changed. "Do you want to reopen it?" Reopening it will destroy your current changes (still in memory).
  4. As per your request, AkelPad reports "Do you want to save changes?" You do, saving the file to its original disk container.
  5. AkelPad continues and reopens the file, as promised - but it is now the file you just saved! Changes made by the external program are gone.
The only way to beat this behaviour already exists; when AkelPad detects a change, don't reopen the file, but save it to another name instead (Save as...). Now reopening the file (F5) opens the file as modified by the external program. I don't see how you could have it both ways without having 2 files (i.e. one renamed).

Am I missing something else here? I supposed AkelPad could do some renaming, etc. for you, but I think this is contrary to the spirit of the program - you have control. If AkelPad is set for multiple files (tabs), then it could open the other file in a new tab, but then you would have 2 "identical" tabs, one that you edited, one edited by an external program - confusing! In non-tabbed mode, the externally modified file would open in a new AkelPad window - same problem (confusing).

Your suggestion, however, a good one - in most cases you would want to save your work before opening the externally modified copy. For some time I have thought that AkelPad should have an (optional) behaviour to save a .bak file, as many other applications do (Instructor - are you listening?!). That way you would always have the current version, and the previous version of any file.

- Surveyor

Offline
Site Admin
Posts: 6311
Joined: Thu Jul 06, 2006 7:20 am

Re: External changes to file detected

Post by Instructor »

Surveyor wrote:For some time I have thought that AkelPad should have an (optional) behaviour to save a .bak file, as many other applications do...
SaveFile::AutoSave?

Offline
Posts: 21
Joined: Mon Mar 14, 2011 1:27 pm

Post by danf84 »

Sorry to reply so late. Completely forgot to check back as I thought the feature was pretty straight forward.

I don't want AkelPad to rename anything. I simply want AkelPad to tell - if the file watch is enabled - that the file has been modified externally, but in the same Message Box also add a note to let me know if file has also been modified internally; if the file hasn't been touched by AkelPad then the standard message should be displayed e.g. "File has been modified externally. Reload? Yes/No", and if it has been modified externally say "File has been modified externally. You've also made changes to the file here which will be lost if you press Yes; Yes/No/Cancel". Then *I* can decide whether to press "Yes" and make a choice to lose my changes or press "Cancel" and do File -> Save As; then the world's your oyster (then I can compare 2 files and ensure no data loss). Now, if the file has changed, and I don't remember whether I made changes to it or not inside AkelPad, and I find myself facing a dialog asking whether to reopen a file or not, I risk of inadvertantly *losing* my changes.

This feature is a *must* if any valuable stuff like code is to be done using AkelPad.

Kind regards, Dan

Offline
Posts: 147
Joined: Fri Feb 08, 2008 6:41 pm
Location: British Columbia, Canada

Post by Surveyor »

Dan,

Re: file changed inside AkelPad, have a look at the User Manual (posted now in the downloads section). Appendix E's ShowModify tool allows you to specify different ways to see if the file is modified (and not yet saved).

- Surveyor
Post Reply