mirror of
				https://github.com/maxgoedjen/secretive.git
				synced 2025-10-31 15:30:57 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			26 lines
		
	
	
		
			735 B
		
	
	
	
		
			Swift
		
	
	
	
	
	
			
		
		
	
	
			26 lines
		
	
	
		
			735 B
		
	
	
	
		
			Swift
		
	
	
	
	
	
| import Foundation
 | |
| 
 | |
| extension URL {
 | |
| 
 | |
|     static var agentHomeURL: URL {
 | |
|         URL(fileURLWithPath: URL.homeDirectory.path().replacingOccurrences(of: Bundle.hostBundleID, with: Bundle.agentBundleID))
 | |
|     }
 | |
| 
 | |
|     static var socketPath: String {
 | |
|         URL.agentHomeURL.appendingPathComponent("socket.ssh").path()
 | |
|     }
 | |
| 
 | |
| }
 | |
| 
 | |
| extension String {
 | |
| 
 | |
|     var normalizedPathAndFolder: (String, String) {
 | |
|         // All foundation-based normalization methods replace this with the container directly.
 | |
|         let processedPath = replacingOccurrences(of: "~", with: "/Users/\(NSUserName())")
 | |
|         let url = URL(filePath: processedPath)
 | |
|         let folder = url.deletingLastPathComponent().path()
 | |
|         return (processedPath, folder)
 | |
|     }
 | |
| 
 | |
| }
 |