转换文件路径为远程主机支持的
(filepath string)
| 331 | |
| 332 | // 转换文件路径为远程主机支持的 |
| 333 | func (instance *SSHRemote) ConvertFilePath(filepath string) (newFilepath string) { |
| 334 | newFilepath = filepath |
| 335 | |
| 336 | newFilepath = strings.ReplaceAll(filepath, "\\", "/") |
| 337 | |
| 338 | index := strings.Index(newFilepath, "~/") |
| 339 | if index == 0 { |
| 340 | pwd, err := instance.GetRemotePwd() |
| 341 | CheckError(err) |
| 342 | newFilepath = path.Join(pwd, strings.Replace(newFilepath, "~/", "", -1)) |
| 343 | } else { |
| 344 | newFilepath = strings.ReplaceAll(newFilepath, "~/", "") |
| 345 | } |
| 346 | |
| 347 | return newFilepath |
| 348 | } |
| 349 | |
| 350 | // 检测远程服务器的环境,是否安装docker、docker-compose、git |
| 351 | func (instance *SSHRemote) CheckRemoteEnv() error { |
no test coverage detected