@ApiStatus.Internal
  public static void installAfterRestart(@NotNull IdeaPluginDescriptor descriptor,
                                         @NotNull Path sourceFile,
                                         @Nullable Path existingPlugin,
                                         boolean deleteSourceFile) throws IOException {
    List<ActionCommand> commands = new ArrayList<>();

    if (existingPlugin != null) {
      commands.add(new DeleteCommand(existingPlugin));
    }

    Path pluginsPath = getPluginsPath();
    if (sourceFile.getFileName().toString().endsWith(".jar")) {
      commands.add(new CopyCommand(sourceFile, pluginsPath.resolve(sourceFile.getFileName())));
    }
    else {
      // drops stale directory
      commands.add(new DeleteCommand(pluginsPath.resolve(rootEntryName(sourceFile))));
      commands.add(new UnzipCommand(sourceFile, pluginsPath));
    }

    if (deleteSourceFile) {
      commands.add(new DeleteCommand(sourceFile));
    }

    addActionCommands(commands);

    PluginStateManager.fireState(descriptor, true);
  }
@ApiStatus.Internal
  public static void installAfterRestart(@NotNull IdeaPluginDescriptor descriptor,
                                         @NotNull Path sourceFile,
                                         @Nullable Path existingPlugin,
                                         boolean deleteSourceFile)