@@ -86,8 +86,8 @@ final class SSHConfigParser {
8686 hostname: currentHostname,
8787 port: currentPort,
8888 user: currentUser,
89- identityFile: expandPath ( currentIdentityFile) ,
90- identityAgent: expandPath ( currentIdentityAgent) ,
89+ identityFile: currentIdentityFile. map ( SSHPathUtilities . expandTilde ) ,
90+ identityAgent: currentIdentityAgent. map ( SSHPathUtilities . expandTilde ) ,
9191 proxyJump: currentProxyJump
9292 ) )
9393 }
@@ -133,8 +133,8 @@ final class SSHConfigParser {
133133 hostname: currentHostname,
134134 port: currentPort,
135135 user: currentUser,
136- identityFile: expandPath ( currentIdentityFile) ,
137- identityAgent: expandPath ( currentIdentityAgent) ,
136+ identityFile: currentIdentityFile. map ( SSHPathUtilities . expandTilde ) ,
137+ identityAgent: currentIdentityAgent. map ( SSHPathUtilities . expandTilde ) ,
138138 proxyJump: currentProxyJump
139139 ) )
140140 }
@@ -192,14 +192,4 @@ final class SSHConfigParser {
192192 return jumpHosts
193193 }
194194
195- /// Expand ~ to home directory in path
196- private static func expandPath( _ path: String ? ) -> String ? {
197- guard let path = path else { return nil }
198-
199- if path. hasPrefix ( " ~ " ) {
200- return FileManager . default. homeDirectoryForCurrentUser
201- . appendingPathComponent ( String ( path. dropFirst ( 2 ) ) ) . path ( percentEncoded: false )
202- }
203- return path
204- }
205195}
0 commit comments