@@ -91,7 +91,9 @@ public void execute()
9191 {
9292 String dest = ( (SymlinkDestinationSupplier ) resource ).getSymlinkDestination ();
9393 File target = new File ( dest );
94- SymlinkUtils .createSymbolicLink ( new File ( fileName ), target );
94+ File symlink = new File ( fileName );
95+ makeParentDirectories ( symlink );
96+ SymlinkUtils .createSymbolicLink ( symlink , target );
9597 }
9698 else
9799 {
@@ -142,15 +144,7 @@ protected void copyFile( final ArchiveEntry entry, final String vPath )
142144
143145 if ( !in .isDirectory () )
144146 {
145- if ( !outFile .getParentFile ().exists () )
146- {
147- // create the parent directory...
148- if ( !outFile .getParentFile ().mkdirs () )
149- {
150- // Failure, unable to create specified directory for some unknown reason.
151- throw new ArchiverException ( "Unable to create directory or parent directory of " + outFile );
152- }
153- }
147+ makeParentDirectories ( outFile );
154148 ResourceUtils .copyFile ( entry .getInputStream (), outFile );
155149
156150 setFileModes ( entry , outFile , inLastModified );
@@ -187,6 +181,18 @@ public void run()
187181
188182 }
189183
184+ private static void makeParentDirectories ( File file ) {
185+ if ( !file .getParentFile ().exists () )
186+ {
187+ // create the parent directory...
188+ if ( !file .getParentFile ().mkdirs () )
189+ {
190+ // Failure, unable to create specified directory for some unknown reason.
191+ throw new ArchiverException ( "Unable to create directory or parent directory of " + file );
192+ }
193+ }
194+ }
195+
190196 private void setFileModes ( ArchiveEntry entry , File outFile , long inLastModified )
191197 {
192198 if ( !isIgnorePermissions () )
0 commit comments