diff --git a/README.md b/README.md index 36f61d6ff66b973061b8de24b7bf9c9e8953db14..65da32fbec44e5e320ebb2836d7a4a296d9d54eb 100644 --- a/README.md +++ b/README.md @@ -6,10 +6,10 @@ A file change watcher wrapper based on [fs](https://github.com/synrc/fs) ## System Support - Mac fsevent -- Linux and FreeBSD inotify +- Linux, FreeBSD and OpenBSD inotify - Windows inotify-win -NOTE: On Linux and FreeBSD you need to install inotify-tools. +NOTE: On Linux, FreeBSD and OpenBSD you need to install inotify-tools. ## Usage diff --git a/lib/file_system.ex b/lib/file_system.ex index 23f98aee99c7e2c85ffff67fdb0602dfbbdc297c..623a0f253d04d604a5529a3337c9af42a6ba2f89 100644 --- a/lib/file_system.ex +++ b/lib/file_system.ex @@ -7,7 +7,7 @@ defmodule FileSystem do * `:dirs` ([string], required), the dir list to monitor * `:backend` (atom, optional), default backends: `:fs_mac` - for `macos`, `:fs_inotify` for `linux` and `freebsd`, + for `macos`, `:fs_inotify` for `linux`, `freebsd` and `openbsd`, `:fs_windows` for `windows` * `:name` (atom, optional), `name` can be used to subscribe as diff --git a/lib/file_system/backend.ex b/lib/file_system/backend.ex index 3fe5d2cc0e1fa3ca7d62723c925b9f7f7a174294..ce1243a569a6af4dcfe74725023a231ae65375c8 100644 --- a/lib/file_system/backend.ex +++ b/lib/file_system/backend.ex @@ -33,6 +33,7 @@ defmodule FileSystem.Backend do {:unix, :darwin} -> :fs_mac {:unix, :linux} -> :fs_inotify {:unix, :freebsd} -> :fs_inotify + {:unix, :openbsd} -> :fs_inotify {:win32, :nt} -> :fs_windows system -> {:unsupported_system, system} end |> backend_module diff --git a/lib/file_system/backends/fs_inotify.ex b/lib/file_system/backends/fs_inotify.ex index 88b6e562756dd3c3fdddf54bceedf267719fd321..f18e6e222e8464bf04051dd502bf7bc66f3c9007 100644 --- a/lib/file_system/backends/fs_inotify.ex +++ b/lib/file_system/backends/fs_inotify.ex @@ -3,7 +3,7 @@ require Logger defmodule FileSystem.Backends.FSInotify do @moduledoc """ This file is a fork from https://github.com/synrc/fs. - FileSysetm backend for linux and freebsd, a GenServer receive data from Port, parse event + FileSysetm backend for linux, freebsd and openbsd, a GenServer receive data from Port, parse event and send it to the worker process. Need `inotify-tools` installed to use this backend. @@ -37,7 +37,7 @@ defmodule FileSystem.Backends.FSInotify do end def supported_systems do - [{:unix, :linux}, {:unix, :freebsd}] + [{:unix, :linux}, {:unix, :freebsd}, {:unix, :openbsd}] end def known_events do diff --git a/lib/file_system/backends/fs_poll.ex b/lib/file_system/backends/fs_poll.ex index 826b39cbc4f0e1b668dcd849d0b99cb8624f5b19..362ed1d30af0347243cd9a58e57a24729047ef3e 100644 --- a/lib/file_system/backends/fs_poll.ex +++ b/lib/file_system/backends/fs_poll.ex @@ -23,7 +23,7 @@ defmodule FileSystem.Backends.FSPoll do def bootstrap, do: :ok def supported_systems do - [{:unix, :linux}, {:unix, :freebsd}, {:unix, :darwin}, {:win32, :nt}] + [{:unix, :linux}, {:unix, :freebsd}, {:unix, :openbsd}, {:unix, :darwin}, {:win32, :nt}] end def known_events do