MCPcopy Create free account
hub / github.com/OpenAtomFoundation/SmartIDE / IsFileExist

Method IsFileExist

cli/pkg/common/sshremote.go:183–192  ·  view source on GitHub ↗

文件是否存在

(filepath string)

Source from the content-addressed store, hash-verified

181
182// 文件是否存在
183func (instance *SSHRemote) IsFileExist(filepath string) bool {
184
185 filepath = instance.ConvertFilePath(filepath)
186
187 command := fmt.Sprintf(`[[ -f "%v" ]] && echo "1" || echo "0"`, filepath)
188 outContent, err := instance.ExeSSHCommand(command)
189 CheckError(err)
190
191 return outContent == "1"
192}
193
194// 文件是否存在
195func (instance *SSHRemote) IsDirExist(filepath string) bool {

Callers 8

CopyDirectoryMethod · 0.95
stopRemoteFunction · 0.95
VmNewFunction · 0.95
RemoveRemoteFunction · 0.95
ExecuteVmStartCmdFunction · 0.95
checkRemoteDirFunction · 0.80
checkRemoteDirFunction · 0.80

Calls 3

ConvertFilePathMethod · 0.95
ExeSSHCommandMethod · 0.95
CheckErrorFunction · 0.85

Tested by

no test coverage detected