@@ -216,7 +216,7 @@ private void ArchivePath(string fullInputPath, PathTransformer.ITransformedPath
216216
217217 private void ArchiveContents ( PathTransformer . ITransformedPath transformedPath , string contents )
218218 {
219- var dest = NestPaths ( logger , archive , transformedPath . Value ) ;
219+ var dest = FileUtils . NestPaths ( logger , archive , transformedPath . Value ) ;
220220 var tmpSrcFile = Path . GetTempFileName ( ) ;
221221 File . WriteAllText ( tmpSrcFile , contents , utf8 ) ;
222222 try
@@ -231,38 +231,6 @@ private void ArchiveContents(PathTransformer.ITransformedPath transformedPath, s
231231 }
232232 }
233233
234- public static string NestPaths ( ILogger logger , string ? outerpath , string innerpath )
235- {
236- var nested = innerpath ;
237- if ( ! string . IsNullOrEmpty ( outerpath ) )
238- {
239- // Remove all leading path separators / or \
240- // For example, UNC paths have two leading \\
241- innerpath = innerpath . TrimStart ( Path . DirectorySeparatorChar , Path . AltDirectorySeparatorChar ) ;
242-
243- if ( innerpath . Length > 1 && innerpath [ 1 ] == ':' )
244- innerpath = innerpath [ 0 ] + "_" + innerpath . Substring ( 2 ) ;
245-
246- nested = Path . Combine ( outerpath , innerpath ) ;
247- }
248- try
249- {
250- var directoryName = Path . GetDirectoryName ( nested ) ;
251- if ( directoryName is null )
252- {
253- logger . Log ( Severity . Warning , "Failed to get directory name from path '" + nested + "'." ) ;
254- throw new InvalidOperationException ( ) ;
255- }
256- Directory . CreateDirectory ( directoryName ) ;
257- }
258- catch ( PathTooLongException )
259- {
260- logger . Log ( Severity . Warning , "Failed to create parent directory of '" + nested + "': Path too long." ) ;
261- throw ;
262- }
263- return nested ;
264- }
265-
266234 private static string TrapExtension ( CompressionMode compression )
267235 {
268236 switch ( compression )
@@ -280,7 +248,7 @@ public static string TrapPath(ILogger logger, string? folder, PathTransformer.IT
280248 if ( string . IsNullOrEmpty ( folder ) )
281249 folder = Directory . GetCurrentDirectory ( ) ;
282250
283- return NestPaths ( logger , folder , filename ) ;
251+ return FileUtils . NestPaths ( logger , folder , filename ) ;
284252 }
285253 }
286254}
0 commit comments