22
22
import org .codehaus .plexus .archiver .ResourceIterator ;
23
23
import org .codehaus .plexus .archiver .util .ArchiveEntryUtils ;
24
24
import org .codehaus .plexus .archiver .util .ResourceUtils ;
25
+ import org .codehaus .plexus .archiver .UnixStat ;
25
26
import org .codehaus .plexus .components .io .attributes .SymlinkUtils ;
26
27
import org .codehaus .plexus .components .io .functions .SymlinkDestinationSupplier ;
27
28
import org .codehaus .plexus .components .io .resources .PlexusIoResource ;
28
29
30
+ import java .nio .file .Path ;
31
+ import java .nio .file .Paths ;
29
32
import java .io .File ;
30
33
import java .io .IOException ;
31
34
@@ -141,11 +144,6 @@ protected void copyFile( final ArchiveEntry entry, final String vPath )
141
144
}
142
145
}
143
146
ResourceUtils .copyFile ( entry .getInputStream (), outFile );
144
-
145
- if ( !isIgnorePermissions () )
146
- {
147
- ArchiveEntryUtils .chmod ( outFile , entry .getMode (), getLogger (), isUseJvmChmod () );
148
- }
149
147
}
150
148
else
151
149
{ // file is a directory
@@ -166,6 +164,15 @@ else if ( !outFile.mkdirs() )
166
164
}
167
165
}
168
166
167
+ if ( !isIgnorePermissions () )
168
+ {
169
+ // compute relative path
170
+ String relative = outFile .getAbsolutePath ().replaceFirst (getDestFile ().getAbsolutePath (), "." );
171
+ getLogger ().info ( "Set chmod " + Integer .toOctalString ( 0x0fff & entry .getMode () ) + " for " + relative );
172
+ // call chmod (java or system)
173
+ ArchiveEntryUtils .chmod ( outFile , entry .getMode (), getLogger (), isUseJvmChmod () );
174
+ }
175
+
169
176
outFile .setLastModified ( inLastModified == PlexusIoResource .UNKNOWN_MODIFICATION_DATE ? System .currentTimeMillis ()
170
177
: inLastModified );
171
178
}
0 commit comments