Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

winapi.watch_for_file_changes only returns filename to callback #14

Open
squirrelpiles opened this issue Nov 4, 2014 · 8 comments
Open

Comments

@squirrelpiles
Copy link

this code from docs:
winapi.watch_for_file_changes(dir, winapi.FILE_NOTIFY_CHANGE_LAST_WRITE, FALSE,
function(who,what)
print(who,what)
end
)
as well as test-watcher.lua, only returns a single value - the filename of the file. Do not get value such as winapi.FILE_ACTION_MODIFIED to identify the nature of the change event.

running on Windows 7 SP1 32-bit, lua 5.1.4

@stevedonovan
Copy link
Owner

Good point - we should return both values.

@squirrelpiles
Copy link
Author

so you will fix it? :-)

@stevedonovan
Copy link
Owner

Oh yes! I'm Linuxing at work, but I'll fix it tonight.

@stevedonovan
Copy link
Owner

I had a look at test-watcher.lua in the examples folder, and we do get the notification code as well as the file name. There I've just passed print as the callback. This is also Windows 7 SP1, but 64-bit. What happens if you run that example?

@squirrelpiles
Copy link
Author

same as before, just the filename. I installed via luarocks - version 1.4.2-1
how can I determine if that is most current?

@stevedonovan
Copy link
Owner

That is the version I'm working with, yes.

With that version, if I just pass print as the callback I do get a number and a filename.

Have a look at https://github.com/stevedonovan/winapi/blob/master/examples/test-watcher.lua

@squirrelpiles
Copy link
Author

yes, I have ran that. here is output (typed, not cut&pasted):

out.txt
without_spaces
out.txt
without_spaces
frodo.txt
mobo.text

then a long sequence of:
out.txt

followed by:
lua: (error object is not a string)

@squirrelpiles
Copy link
Author

I have run on Win7 on real hardware and on VMWare.

let me know if I can provide any more info etc.

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

No branches or pull requests

2 participants