joyent/libuv — pull request #1436 by nitoyon (2014-08-23 15:27:10+00:00)
Title: windows: ensure fs_event always provides filename

`uv_fs_event` didn't provide filename argument on Windows when a file is deleted or renamed, although it does on Linux.

Fix this by ensuring that fs_event always provides filename argument on Windows.

----

Node.js API document says:

> Providing `filename` argument in the callback is not supported on every platform (currently it's only supported on Linux and Windows). Even on supported platforms `filename` is not always guaranteed to be provided.
>
> http://nodejs.org/docs/latest/api/fs.html#fs_filename_argument

But, it's better that we provide `filename` argument if we can, isn't it?

# How to reproduce this bug

Use following script:

```javascript
var fs = require('fs');

var monitor = fs.watch('./', function(changes, fn) {
console.log("%s : %s", changes, fn);
});

fs.writeFileSync('foo.txt', 'new contents');
fs.renameSync('foo.txt', 'bar.txt');
fs.unlinkSync('bar.txt');

setTimeout(function() {
monitor.close();
}, 1000);
```

## Linux

On CentOS 6.4 x64 (Node.js v0.10.29)

```console
$ node test.js
rename : foo.txt # writeFile
change : foo.txt # writeFile
rename : foo.txt # rename (src)
rename : bar.txt # rename (dst)
rename : bar.txt # unlink
```

On Windows 8.1 x64 (Node.j v0.10.21)

```console
> node test.js
rename : foo.txt # writeFile
change : foo.txt # writeFile
rename : null # rename (src) <--- FIX THIS
rename : bar.txt # rename (dst)
rename : null # unlink <--- FIX THIS
```