Skip to content

Commit

Permalink
refactor(src/core/fs.cc): guard 'FileSystemWatcher' from android
Browse files Browse the repository at this point in the history
  • Loading branch information
jwerle committed Oct 31, 2023
1 parent e2fb315 commit 169df25
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions src/core/fs.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1059,6 +1059,17 @@ namespace SSC {
Module::Callback cb
) {
this->core->dispatchEventLoop([=, this]() {
#if defined(__ANDROID__)
auto json = JSON::Object::Entries {
{"source", "fs.watch"},
{"err", JSON::Object::Entries {
{"message", "Not supported"}
}}
};

cb(seq, json, Post{});
return;
#else
FileSystemWatcher* watcher;
{
Lock lock(this->mutex);
Expand Down Expand Up @@ -1120,6 +1131,7 @@ namespace SSC {
};

cb(seq, json, Post{});
#endif
});
}

Expand Down Expand Up @@ -1248,6 +1260,17 @@ namespace SSC {
Module::Callback cb
) {
this->core->dispatchEventLoop([=, this]() {
#if defined(__ANDROID__)
auto json = JSON::Object::Entries {
{"source", "fs.stopWatch"},
{"err", JSON::Object::Entries {
{"message", "Not supported"}
}}
};

cb(seq, json, Post{});
return;
#else
auto watcher = this->core->fs.watchers[id];
if (watcher != nullptr) {
watcher->stop();
Expand All @@ -1271,6 +1294,7 @@ namespace SSC {

cb(seq, json, Post{});
}
#endif
});
}

Expand Down

0 comments on commit 169df25

Please sign in to comment.