@@ -91,7 +91,9 @@ public void execute()
91
91
{
92
92
String dest = ( (SymlinkDestinationSupplier ) resource ).getSymlinkDestination ();
93
93
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 );
95
97
}
96
98
else
97
99
{
@@ -142,15 +144,7 @@ protected void copyFile( final ArchiveEntry entry, final String vPath )
142
144
143
145
if ( !in .isDirectory () )
144
146
{
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 );
154
148
ResourceUtils .copyFile ( entry .getInputStream (), outFile );
155
149
156
150
setFileModes ( entry , outFile , inLastModified );
@@ -187,6 +181,18 @@ public void run()
187
181
188
182
}
189
183
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
+
190
196
private void setFileModes ( ArchiveEntry entry , File outFile , long inLastModified )
191
197
{
192
198
if ( !isIgnorePermissions () )
0 commit comments