Skip to content

Commit

Permalink
Fix reinstall plugins
Browse files Browse the repository at this point in the history
  • Loading branch information
ziulev committed Nov 21, 2022
1 parent d8e8f1d commit b0fda44
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 7 deletions.
2 changes: 1 addition & 1 deletion PKGBUILD
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Maintainer: Denis Ziulev <[email protected]>
pkgname=spotter
pkgver=1.9.9
pkgver=1.9.10
pkgrel=1
pkgdesc="Simple and powerful tool to launch everything"
arch=('x86_64')
Expand Down
22 changes: 16 additions & 6 deletions lib/plugin_service.dart
Original file line number Diff line number Diff line change
Expand Up @@ -153,8 +153,9 @@ class PluginsServer {
(registeredPlugin) => registeredPlugin.contains(plugin)) !=
null;

// TODO: check
if (alreadyRegistered) {
return false;
await removePlugin(plugin);
}

// TODO: return single item
Expand All @@ -179,11 +180,20 @@ class PluginsServer {
}

removePlugin(String plugin) async {
// await pluginsRegistryStorage.ready;
// List<String> pluginsRegistry = pluginsRegistryStorage.getItem('plugins_registry');
// pluginsRegistryStorage.setItem('plugins_registry', pluginsRegistry.where((p) => p != plugin));
// TODO: kill process
// kill -9 $(pidof 'plugin_name')
await shell.run('rm -rf plugins/$plugin');
List<String> pluginPath = plugin.split('/');
String pluginName = pluginPath[1];
String platform = Platform.isLinux ? 'linux' : 'macos';
String pluginFullName = '$pluginName-$platform';
List<String> pluginsRegistry = await getPluginsRegistry();
storage.write(
'plugins_registry', pluginsRegistry.where((p) => p != plugin));

try {
await shell.run('killall $pluginFullName');
} catch (err) {
return;
}
}

Future<PluginRequest> findPluginRequest(String requestId) async {
Expand Down

0 comments on commit b0fda44

Please sign in to comment.