Class LinuxSchemeInstaller

  • All Implemented Interfaces:
    SchemeInstaller

    public class LinuxSchemeInstaller
    extends Object
    implements SchemeInstaller
    Linux implementation of SchemeInstaller using .desktop files.

    This implementation modifies the application's .desktop file to add URI scheme handlers via the MimeType field, then registers them using xdg-mime.

    Author:
    Curtis Rueden
    • Constructor Detail

      • LinuxSchemeInstaller

        public LinuxSchemeInstaller​(Path desktopFilePath,
                                    org.scijava.log.LogService log)
    • Method Detail

      • isSupported

        public boolean isSupported()
        Description copied from interface: SchemeInstaller
        Checks if this installer is supported on the current platform.
        Specified by:
        isSupported in interface SchemeInstaller
        Returns:
        true if the installer can run on this OS
      • install

        public void install​(String scheme,
                            String executablePath)
                     throws IOException
        Description copied from interface: SchemeInstaller
        Installs a URI scheme handler in the operating system.
        Specified by:
        install in interface SchemeInstaller
        Parameters:
        scheme - The URI scheme to register (e.g., "myapp")
        executablePath - The absolute path to the executable to launch
        Throws:
        IOException - if installation fails
      • isInstalled

        public boolean isInstalled​(String scheme)
        Description copied from interface: SchemeInstaller
        Checks if a URI scheme is already registered.
        Specified by:
        isInstalled in interface SchemeInstaller
        Parameters:
        scheme - The URI scheme to check
        Returns:
        true if the scheme is already registered
      • getInstalledPath

        public String getInstalledPath​(String scheme)
        Description copied from interface: SchemeInstaller
        Gets the executable path registered for a given scheme.
        Specified by:
        getInstalledPath in interface SchemeInstaller
        Parameters:
        scheme - The URI scheme to query
        Returns:
        The registered executable path, or null if not registered
      • uninstall

        public void uninstall​(String scheme)
                       throws IOException
        Description copied from interface: SchemeInstaller
        Uninstalls a URI scheme handler from the operating system.
        Specified by:
        uninstall in interface SchemeInstaller
        Parameters:
        scheme - The URI scheme to unregister
        Throws:
        IOException - if uninstallation fails