Deleting file which V has open
Moderator: vuser
Deleting file which V has open
Apparently, other apps are allowed to delete a file while V has it opened. Is that by design?
- Vince
- Vince
-
- Site Admin
- Posts: 287
- Joined: Fri Apr 30, 2010 5:50 pm
Re: Deleting file which V has open
Yes. As V is a viewer only, it does not lock the file while it is viewing it.Apparently, other apps are allowed to delete a file while V has it opened. Is that by design?
If it did, files would not be able to be modified while V was viewing them. This would be a problem when viewing some log files,
as locking the file would disable the log file from being updated.
And there is no option in V to lock the file while you are viewing it.
Charles.
Re: Deleting file which V has open
Is it possible to keep V from watching the file and reloading it if there are changes?FileViewer wrote: And there is no option in V to lock the file while you are viewing it.
- Vince
Re: Deleting file which V has open
Can't you open it with FILE_SHARE_READ | FILE_SHARE_WRITE and not FILE_SHARE_DELETE?
- Vince
- Vince
Re: Deleting file which V has open
Not quite, but you can have it prompt you before the file is reloaded. Clicking OK is the only option on the prompt so it's always reloaded eventually.
Re: Deleting file which V has open
Not much of a prompt, eh! That's silly. What if I don't want it reloaded? What of I don't even want it watched? Charles mentioned log files. How can you look at a log file without continually dismissing that "prompt".ron wrote:Not quite, but you can have it prompt you before the file is reloaded. Clicking OK is the only option on the prompt so it's always reloaded eventually.
Odd ... if, while viewing a file you turn on File\Tail ... then turn it off ... you can thereafter freely write to the file or even delete it without V knowing about it.
-
- Site Admin
- Posts: 287
- Joined: Fri Apr 30, 2010 5:50 pm
Re: Deleting file which V has open
As Ron said, no.Is it possible to keep V from watching the file and reloading it if there are changes?
You don't have an option. The file you are viewing has changed. The data you were previously viewing no longer exists (or has been modified).Not much of a prompt, eh! That's silly. What if I don't want it reloaded?
V must reload the file in order to display it correctly. The prompt is only there to inform you that the file has changed.
You do not get the reload prompt if the file being viewed has simply been appended to (as in log files). You only getHow can you look at a log file without continually dismissing that "prompt".
it if any part of the file that was originally opened has been modified.
Opening the file with FILE_SHARE_DELETE will not stop the file from being deleted as the file is not openCan't you open it with FILE_SHARE_READ | FILE_SHARE_WRITE and not FILE_SHARE_DELETE?
while V is viewing it. V only opens the file to read what it needs to display and then closes it.
I could very easily stop the file being deleted while V was viewing it - but I don't want to lock it in any way, as this can cause problems.
For example, I might want to view temporary files created by my DVD authoring program while it was authoring a DVD. If I was viewing such a file
when the program wanted to delete it, the authoring would probably fail.
BTW: I assume you asked the original question because you don't want a file that is being viewed to be deleted. Is that right?
Did you accidentally delete a file that was being viewed? Or was it deleted by another program?
Charles.
Re: Deleting file which V has open
Apparently not so. If I "ECHO foo > foo.txt", then "v foo.txt", then go back to the command prompt and "ECHO foo >> foo.txt" (appending to it) then as soon as V gets the foreground, it either updates automatically of after the announcement (depending to my preferences). I don't want that to happen (optionally, of course).
I actually wanted to delete the file (a temporary one). I really don't care about allowing deletion or not. I just don't like V's behavior when the file is deleted or changed (even appended). V's behavior when the file is deleted is rather humorous.
And there should certainly be an option not to watch/update files if that's what the user wants.
I actually wanted to delete the file (a temporary one). I really don't care about allowing deletion or not. I just don't like V's behavior when the file is deleted or changed (even appended). V's behavior when the file is deleted is rather humorous.
And there should certainly be an option not to watch/update files if that's what the user wants.
-
- Site Admin
- Posts: 287
- Joined: Fri Apr 30, 2010 5:50 pm
Re: Deleting file which V has open
You are right. If you switch back to V and it notices that the file has changed, it will always update it (and optionally display the reload message).Apparently not so. If I "ECHO foo > foo.txt", then "v foo.txt", then go back to the command prompt and "ECHO foo >> foo.txt" (appending to it) then as soon as V gets the foreground, it either updates automatically of after the announcement (depending to my preferences).
Unfortunately, this is not possible.I don't want that to happen (optionally, of course)
V does not load the entire file into memory to display it - it always displays the file as it is on the disk. If the file changes then the data
that V displays must also change.
Of course, in the case of data being appended to the file, V could choose to ignore the appended data. If this is what you want, I can
look at adding an option to do that.
Charles.
Re: Deleting file which V has open
> Of course, in the case of data being appended to the file, V could choose to ignore the appended data.
> If this is what you want, I can look at adding an option to do that.
That would be just a drop in the bucket. Don't do that for me. I want it to ignore the file if I so choose (let it have a manual "reload" option). If simply looking at a (small) file as it was when it was read is impossible, that would seem a lack of functionality.
What's up with turning "tail" on/off? That seems to get rid of the monitoring (a bug?). Apparently the ability to turn it off is already there.
> If this is what you want, I can look at adding an option to do that.
That would be just a drop in the bucket. Don't do that for me. I want it to ignore the file if I so choose (let it have a manual "reload" option). If simply looking at a (small) file as it was when it was read is impossible, that would seem a lack of functionality.
What's up with turning "tail" on/off? That seems to get rid of the monitoring (a bug?). Apparently the ability to turn it off is already there.