Friday 1 January 2021

Axosoft/nsfw file monitor doesn’t trigger file changes

The following problem only exists on Windows, on macOS the code below works as expected.

So, I am on Windows 10 (v1909) and installed nsfw in my electron program and can't make it work. I installed it with the following command:

npm install nsfw --save

> nsfw@2.0.0 install C:\Users\daniel\Desktop\my-foo-example\node_modules\nsfw
> node-gyp rebuild

C:\Users\daniel\Desktop\my-foo-example\node_modules\nsfw>if not defined npm_config_node_gyp (node "C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild )  else (node "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" rebuild )
Building the projects in this solution one at a time. To enable parallel build, please add the "-m" switch.
  NSFW.cpp
  Queue.cpp
  NativeInterface.cpp
  Controller.cpp
  Watcher.cpp
  win_delay_load_hook.cc
     Creating library C:\Users\daniel\Desktop\my-foo-example\node_modules\nsfw\build\Release\nsfw.lib a
  nd object C:\Users\daniel\Desktop\my-foo-example\node_modules\nsfw\build\Release\nsfw.exp
  nsfw.vcxproj -> C:\Users\daniel\Desktop\my-foo-example\node_modules\nsfw\build\Release\\nsfw.node
+ nsfw@2.0.0

I call nsfw the following way. I expected "start watching" to be printed, but nothing happens. Also no file changes in the given directory gets printed out. The directory does exist. Am I missing something?


var watcher2;

app.whenReady().then(() => {
  createWindow();

  nsfw(
    "C:\\Users\\daniel\\Desktop\\foo",
    function (events) {
      console.log(events);
    },
    {
      debounceMS: 250,
      errorCallback(errors) {
        console.log(errors);
      },
    }
  )
    .then(function (watcher) {
      watcher2 = watcher;
      console.log("start"); <--- get's executed
      return watcher.start();
    })
    .then(function () {
      console.log("start watching"); <--- DOES NOT get triggered
      // we are now watching dir for events!
    });
});


from Axosoft/nsfw file monitor doesn’t trigger file changes

No comments:

Post a Comment