Class WindowsShortcut

java.lang.Object
slash.common.io.WindowsShortcut
All Implemented Interfaces:
ResolvableLink

public class WindowsShortcut extends Object implements ResolvableLink
Represents a Windows shortcut (typically visible to Java only as a '.lnk' file), the counterpart to a macOS MacAlias. Parsing is delegated to the mslinks library; this class keeps the small facade RouteConverter relies on.
Author:
Christian Pesch
  • Constructor Details

  • Method Details

    • isPotentialValidLink

      public static boolean isPotentialValidLink(File file) throws IOException
      Provides a quick test to see if this could be a valid link. Instantiating a WindowsShortcut for an invalid link throws, and exceptions are slow, so code looping over several files should check this first.
      Parameters:
      file - the potential link
      Returns:
      true if it may be a link, false otherwise
      Throws:
      IOException - if an IOException is thrown while reading from the file
    • getRealFilename

      public String getRealFilename()
      Specified by:
      getRealFilename in interface ResolvableLink
      Returns:
      the name of the filesystem object pointed to by this shortcut
    • isDirectory

      public boolean isDirectory()
      Specified by:
      isDirectory in interface ResolvableLink
      Returns:
      true if the shortcut points to a directory, false otherwise
    • isFile

      public boolean isFile()
      Specified by:
      isFile in interface ResolvableLink
      Returns:
      true if the link points to a file