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

Method IsDirExist

cli/pkg/common/sshremote.go:195–204  ·  view source on GitHub ↗

文件是否存在

(filepath string)

Source from the content-addressed store, hash-verified

193
194// 文件是否存在
195func (instance *SSHRemote) IsDirExist(filepath string) bool {
196
197 filepath = instance.ConvertFilePath(filepath)
198
199 command := fmt.Sprintf(`[[ -d "%v" ]] && echo "1" || echo "0"`, filepath)
200 outContent, err := instance.ExeSSHCommand(command)
201 CheckError(err)
202
203 return outContent == "1"
204}
205
206// 文件是否存在
207func (instance *SSHRemote) IsDirEmpty(dirPath string) bool {

Callers 4

CopyDirectoryMethod · 0.95
stopRemoteFunction · 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