Skip to content
This repository has been archived by the owner on Jun 8, 2022. It is now read-only.

why not don't support watch file? #37

Closed
isdamir opened this issue Mar 13, 2013 · 9 comments
Closed

why not don't support watch file? #37

isdamir opened this issue Mar 13, 2013 · 9 comments
Labels

Comments

@isdamir
Copy link

isdamir commented Mar 13, 2013

No description provided.

@howeyc
Copy link
Owner

howeyc commented Mar 13, 2013

I'm sorry, could you be more specific?

@isdamir
Copy link
Author

isdamir commented Mar 14, 2013

example: Watch("~/tmp/tmp.txt")
i modify tmp.txt,
tip:

2013/03/14 15:41:23 event: "/home/yufeng/tmp/t.txt": RENAME
2013/03/14 15:41:23 event: "/home/yufeng/tmp/t.txt": MODIFY
2013/03/14 15:41:23 event: "/home/yufeng/tmp/t.txt": DELETE

Modified again,no new event.
i want watch file event,not watch dir.

@howeyc
Copy link
Owner

howeyc commented Mar 14, 2013

That's because it is watching a file, and not a file path location. In your
example, once "/home/yufeng/tmp/t.txt" is deleted you lose your watch.

On 14 March 2013 02:44, YuFeng notifications@github.com wrote:

example: Watch("~/tmp/tmp.txt")
i modify tmp.txt,
tip:

2013/03/14 15:41:23 event: "/home/yufeng/tmp/t.txt": RENAME
2013/03/14 15:41:23 event: "/home/yufeng/tmp/t.txt": MODIFY
2013/03/14 15:41:23 event: "/home/yufeng/tmp/t.txt": DELETE

Modified again,no new event.
i want watch file event,not watch dir.


Reply to this email directly or view it on GitHubhttps://github.com//issues/37#issuecomment-14890139
.

@isdamir
Copy link
Author

isdamir commented Mar 15, 2013

no delete it .i'am modify it

@howeyc
Copy link
Owner

howeyc commented Mar 20, 2013

Is it possible you are using a file editor program to do the modify? I've seen some programs delete and recreate files when doing modifications. I don't know why, but they do.

@pcrawfor
Copy link

Ya I've seen Xcode do this, not sure why either

@quarnster
Copy link

Probably an attempt at atomic saves, so they write the file contents to a temporary file, then delete the original file and lastly rename the temp file to the original file's name.

Edit: https://developer.apple.com/library/mac/#documentation/Cocoa/Reference/Foundation/Classes/NSData_Class/Reference/Reference.html#//apple_ref/occ/instm/NSData/writeToFile:atomically:

@mstum
Copy link

mstum commented Mar 23, 2014

If someone stumbles on this via Google: vim does the same, Create Temp, Delete Original (thus losing watch), Rename Temp (which isn't being watched now)

@nathany
Copy link
Contributor

nathany commented Mar 26, 2014

yah, it would seem that pretty much every editor has an "atomic save" like this, presumably to avoid the terrible thing that happens when a file is half written and something crashes.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

6 participants