20
20
import org .codehaus .plexus .archiver .ArchiveEntry ;
21
21
import org .codehaus .plexus .archiver .ArchiverException ;
22
22
import org .codehaus .plexus .archiver .ResourceIterator ;
23
+ import org .codehaus .plexus .archiver .UnixStat ;
23
24
import org .codehaus .plexus .archiver .util .ArchiveEntryUtils ;
24
25
import org .codehaus .plexus .archiver .util .ResourceUtils ;
25
- import org .codehaus .plexus .archiver .UnixStat ;
26
26
import org .codehaus .plexus .components .io .attributes .SymlinkUtils ;
27
27
import org .codehaus .plexus .components .io .functions .SymlinkDestinationSupplier ;
28
28
import org .codehaus .plexus .components .io .resources .PlexusIoResource ;
29
29
30
- import java .nio .file .Path ;
31
- import java .nio .file .Paths ;
32
30
import java .io .File ;
33
31
import java .io .IOException ;
34
32
@@ -85,12 +83,15 @@ public void execute()
85
83
final String destDir = destDirectory .getCanonicalPath ();
86
84
fileName = destDir + File .separator + fileName ;
87
85
PlexusIoResource resource = f .getResource ();
88
- if (resource instanceof SymlinkDestinationSupplier ){
89
- String dest = ((SymlinkDestinationSupplier )resource ).getSymlinkDestination ();
90
- File target = new File (dest );
91
- SymlinkUtils .createSymbolicLink (new File (fileName ), target );
92
- } else {
93
- copyFile (f , fileName );
86
+ if ( resource instanceof SymlinkDestinationSupplier )
87
+ {
88
+ String dest = ( (SymlinkDestinationSupplier ) resource ).getSymlinkDestination ();
89
+ File target = new File ( dest );
90
+ SymlinkUtils .createSymbolicLink ( new File ( fileName ), target );
91
+ }
92
+ else
93
+ {
94
+ copyFile ( f , fileName );
94
95
}
95
96
}
96
97
}
@@ -103,15 +104,12 @@ public void execute()
103
104
104
105
/**
105
106
* Copies the specified file to the specified path, creating any ancestor directory structure as necessary.
106
- *
107
- * @param file
108
- * The file to copy (IOException will be thrown if this does not exist)
109
- * @param vPath
110
- * The fully qualified path to copy the file to.
111
- * @throws ArchiverException
112
- * If there is a problem creating the directory structure
113
- * @throws IOException
114
- * If there is a problem copying the file
107
+ *
108
+ * @param entry the entry top copy
109
+ * The file to copy (IOException will be thrown if this does not exist)
110
+ * @param vPath The fully qualified path to copy the file to.
111
+ * @throws ArchiverException If there is a problem creating the directory structure
112
+ * @throws IOException If there is a problem copying the file
115
113
*/
116
114
protected void copyFile ( final ArchiveEntry entry , final String vPath )
117
115
throws ArchiverException , IOException
@@ -153,8 +151,8 @@ protected void copyFile( final ArchiveEntry entry, final String vPath )
153
151
{
154
152
// should we just delete the file and replace it with a directory?
155
153
// throw an exception, let the user delete the file manually.
156
- throw new ArchiverException ( "Expected directory and found file at copy destination of "
157
- + in .getName () + " to " + outFile );
154
+ throw new ArchiverException (
155
+ "Expected directory and found file at copy destination of " + in .getName () + " to " + outFile );
158
156
}
159
157
}
160
158
else if ( !outFile .mkdirs () )
@@ -164,17 +162,14 @@ else if ( !outFile.mkdirs() )
164
162
}
165
163
}
166
164
167
- if ( !isIgnorePermissions () )
168
- {
169
- // compute relative path
170
- String relative = outFile .getAbsolutePath ().replaceFirst (getDestFile ().getAbsolutePath (), "." );
171
- getLogger ().info ( "Set chmod " + Integer .toString ( UnixStat .PERM_MASK & entry .getMode () ) + " for " + relative );
172
- // call chmod (java or system)
173
- ArchiveEntryUtils .chmod ( outFile , entry .getMode (), getLogger (), isUseJvmChmod () );
174
- }
175
-
176
- outFile .setLastModified ( inLastModified == PlexusIoResource .UNKNOWN_MODIFICATION_DATE ? System .currentTimeMillis ()
177
- : inLastModified );
165
+ if ( !isIgnorePermissions () )
166
+ {
167
+ ArchiveEntryUtils .chmod ( outFile , entry .getMode (), getLogger (), isUseJvmChmod () );
168
+ }
169
+
170
+ outFile .setLastModified ( inLastModified == PlexusIoResource .UNKNOWN_MODIFICATION_DATE
171
+ ? System .currentTimeMillis ()
172
+ : inLastModified );
178
173
}
179
174
180
175
protected void cleanUp ()
0 commit comments