View Javadoc
1   package org.codehaus.plexus.components.io.resources;
2   
3   import org.codehaus.plexus.components.io.attributes.PlexusIoResourceAttributes;
4   import org.codehaus.plexus.components.io.attributes.SymlinkUtils;
5   import org.codehaus.plexus.components.io.functions.SymlinkDestinationSupplier;
6   
7   import javax.annotation.Nonnull;
8   import java.io.File;
9   import java.io.IOException;
10  
11  public class PlexusIoSymlinkResource
12      extends PlexusIoFileResource
13      implements SymlinkDestinationSupplier
14  {
15      private final File symnlinkDestination;
16  
17      PlexusIoSymlinkResource( @Nonnull File symlinkfile, String name, @Nonnull PlexusIoResourceAttributes attrs )
18          throws IOException
19      {
20          super( symlinkfile, name, attrs );
21          this.symnlinkDestination = null;
22      }
23  
24      public String getSymlinkDestination()
25          throws IOException
26      {
27          return symnlinkDestination == null ? SymlinkUtils.readSymbolicLink( getFile() ).getPath() : symnlinkDestination.getPath();
28      }
29  }