| 
									
										
										
										
											2020-09-11 00:11:47 +08:00
										 |  |  | // +build plan9
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | package sftp | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-06-29 23:16:15 +08:00
										 |  |  | import ( | 
					
						
							|  |  |  | 	"path" | 
					
						
							|  |  |  | 	"path/filepath" | 
					
						
							|  |  |  | 	"syscall" | 
					
						
							|  |  |  | ) | 
					
						
							| 
									
										
										
										
											2020-09-11 00:11:47 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | func fakeFileInfoSys() interface{} { | 
					
						
							|  |  |  | 	return &syscall.Dir{} | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | func testOsSys(sys interface{}) error { | 
					
						
							|  |  |  | 	return nil | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2021-06-29 23:16:15 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | func toLocalPath(p string) string { | 
					
						
							|  |  |  | 	lp := filepath.FromSlash(p) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	if path.IsAbs(p) { | 
					
						
							|  |  |  | 		tmp := lp[1:] | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		if filepath.IsAbs(tmp) { | 
					
						
							|  |  |  | 			// If the FromSlash without any starting slashes is absolute,
 | 
					
						
							|  |  |  | 			// then we have a filepath encoded with a prefix '/'.
 | 
					
						
							|  |  |  | 			// e.g. "/#s/boot" to "#s/boot"
 | 
					
						
							|  |  |  | 			return tmp | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	return lp | 
					
						
							|  |  |  | } |