Package slash.common.io
Class MacAlias
java.lang.Object
slash.common.io.MacAlias
- All Implemented Interfaces:
ResolvableLink
Represents a macOS Finder alias (a regular file carrying bookmark data, the
counterpart to a Windows
WindowsShortcut). Detection sniffs the
"book" bookmark-data magic; resolution to the target path is delegated to
osascript/Finder, since the bookmark format is not stably parseable.- Author:
- Christian Pesch
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanbooleanisFile()static booleanisPotentialValidAlias(File file) Provides a quick test to see if this could be a valid macOS alias.
-
Constructor Details
-
MacAlias
- Throws:
IOException
-
-
Method Details
-
isPotentialValidAlias
Provides a quick test to see if this could be a valid macOS alias. Instantiating aMacAliasspawns anosascriptprocess, so any code looping over several files should first check this.- Parameters:
file- the potential alias- Returns:
- true if this is a macOS running a file that carries the alias magic, false otherwise
- Throws:
IOException- if an IOException is thrown while reading from the file
-
getRealFilename
- Specified by:
getRealFilenamein interfaceResolvableLink- Returns:
- the name of the filesystem object pointed to by this alias
-
isDirectory
public boolean isDirectory()- Specified by:
isDirectoryin interfaceResolvableLink- Returns:
- true if the alias points to a directory, false otherwise
-
isFile
public boolean isFile()- Specified by:
isFilein interfaceResolvableLink- Returns:
- true if the link points to a file
-