rabite0 / hunter

The fastest file manager in the galaxy!
Do What The F*ck You Want To Public License
1.31k stars 64 forks source link

Cross-platfrom file watching support #12

Closed mre closed 5 years ago

mre commented 5 years ago

On macOS, compilation currently fails with the following error message:

  Compiling hunter v1.0.1 (/Users/mendler/Code/upstream/hunter)
error[E0432]: unresolved import `notify::INotifyWatcher`
 --> src/fscache.rs:1:14
  |
1 | use notify::{INotifyWatcher, Watcher, DebouncedEvent, RecursiveMode};
  |              ^^^^^^^^^^^^^^ no `INotifyWatcher` in the root

That's because inotifywatch is Linux-specific. I recommend https://github.com/passcod/notify for cross-platform filesystem notifications.

rabite0 commented 5 years ago

Is that the only blocking issue for OSX? Hard to say I guess.

Should be an easy fix, that's the library I'm actually already using, so this would be a small change. Will look into that. Thanks for reporting.

mre commented 5 years ago

Yeah from what I can tell, it should be the only issue. The other crates either explicitly mention macOS support or they are platform-independent.

dmilith commented 5 years ago

https://twitter.com/dmilith/status/1116298950066176001

dmilith commented 5 years ago

To make a long story short - "inotify" (but also epoll) are Linux only "techno-logies", so using Linux only stuff will limit usability of the project on other platforms :)

rabite0 commented 5 years ago

Yeah, this also prevents it from working on BSD systems. Ironically it works nicely on Windows (with WSL)... The crate I use is already cross-platform, I just failed to use it that way, so this shouldn't take much work. Will fix this in the next few days.

rabite0 commented 5 years ago

Ok, so I did take a look and it was even easier to fix than I thought, just needed to replace InotifyWatcher with RecommendedWatcher at three points.

There are likely to be issues with how those notifications are handled/issued at the OS level due to differences between systems and I will take a look into that later, but it should at least compile and run now.

EDIT: From what I can see the only issues that might arise affect all platforms since I was lazy, so if it runs this is more or less solved.

berkus commented 5 years ago

Yeah, please do! Jumping wanna try it on macOS.

rabite0 commented 5 years ago

I already did, it's in the master branch. :) Just waiting for someone to report success before I close the issue.

davidpdrsn commented 5 years ago

It isn't working for me. It builds successfully crashes on launch

Screenshot 2019-04-11 at 15 54 09

I installed libmagic with brew reinstall libmagic. macOS 10.14.3, running in tmux.

rabite0 commented 5 years ago

From the looks of it, this is caused by the metadata-fetching, maybe related to the thread-pool somehow. Will investigate further, thanks for testing.

Closing this issue since this crash has nothing to do with file watching.

rabite0 commented 5 years ago

See : #17

Please test if it works.

berkus commented 5 years ago

Cool, it builds, but crashes immediately on startup. Will open a new ticket.

Ah, wait, I see you did something in #17 but the version from crates.io still crashes. Was there a release with fix yet?

rabite0 commented 5 years ago

It seemed to be fine from the reports I got, but apparently not. :(

Please open a new issue and include a stack trace if you can. It's probably rather an issue with a file it tries to load, rather than something that has to do with macOS. Since I added the panic-handler it should print it fine when it crashes.

You could try to open it in different directories and see if it starts up.

berkus commented 5 years ago

Hi! Not opening a new issue, because version 1.1.0 works fine on my mac! 🙇