@@ -65,16 +65,17 @@ extension Application {
6565 switch ( srcRef, dstRef) {
6666 case ( . container( let id, let path) , . local( let localPath) ) :
6767 let srcPath = FilePath ( path)
68- let destPath = FilePath ( ( localPath as NSString ) . standardizingPath )
68+ let destPath = FilePath ( URL ( fileURLWithPath : localPath, relativeTo : . currentDirectory ( ) ) . absoluteURL . path ( percentEncoded : false ) )
6969 var isDirectory : ObjCBool = false
7070 let exists = FileManager . default. fileExists ( atPath: destPath. string, isDirectory: & isDirectory)
7171
72+ var finalDestPath = destPath
7273 if exists && isDirectory. boolValue {
7374 guard let lastComponent = srcPath. lastComponent else {
7475 throw ContainerizationError ( . invalidArgument, message: " source path has no last component: \( path) " )
7576 }
76- let finalDest = destPath. appending ( lastComponent)
77- try await client. copyOut ( id: id, source: path, destination: finalDest . string)
77+ finalDestPath = destPath. appending ( lastComponent)
78+ try await client. copyOut ( id: id, source: path, destination: finalDestPath . string)
7879 } else if localPath. hasSuffix ( " / " ) {
7980 try await client. copyOut ( id: id, source: path, destination: destPath. string)
8081 var resultIsDir : ObjCBool = false
@@ -89,9 +90,15 @@ extension Application {
8990 } else {
9091 try await client. copyOut ( id: id, source: path, destination: destPath. string)
9192 }
93+ print ( finalDestPath. string)
9294 case ( . local( let localPath) , . container( let id, let path) ) :
93- let srcPath = FilePath ( ( localPath as NSString ) . standardizingPath )
95+ let srcPath = FilePath ( URL ( fileURLWithPath : localPath, relativeTo : . currentDirectory ( ) ) . absoluteURL . path ( percentEncoded : false ) )
9496 var isDirectory : ObjCBool = false
97+
98+ guard let lastComponent = srcPath. lastComponent else {
99+ throw ContainerizationError ( . invalidArgument, message: " source path has no last component: \( localPath) " )
100+ }
101+
95102 guard FileManager . default. fileExists ( atPath: srcPath. string, isDirectory: & isDirectory) else {
96103 throw ContainerizationError ( . notFound, message: " source path does not exist: \( localPath) " )
97104 }
@@ -100,6 +107,8 @@ extension Application {
100107 }
101108
102109 try await client. copyIn ( id: id, source: srcPath. string, destination: path, createParents: true )
110+ let printedDest = path. hasSuffix ( " / " ) ? " \( id) : \( path) \( lastComponent. string) " : " \( id) : \( path) "
111+ print ( printedDest)
103112 case ( . container, . container) :
104113 throw ContainerizationError ( . invalidArgument, message: " copying between containers is not supported " )
105114 case ( . local, . local) :
0 commit comments