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

Method CheckAndCreateDir

cli/pkg/common/sshremote.go:323–330  ·  view source on GitHub ↗

检查并创建文件夹

(dir string)

Source from the content-addressed store, hash-verified

321
322// 检查并创建文件夹
323func (sshRemote *SSHRemote) CheckAndCreateDir(dir string) error {
324 dir = sshRemote.ConvertFilePath(dir)
325
326 command := fmt.Sprintf("[[ -f \"%v\" ]] && echo \"1\" || mkdir -p \"%v\"", dir, dir)
327 _, err := sshRemote.ExeSSHCommand(command)
328 return err
329
330}
331
332// 转换文件路径为远程主机支持的
333func (instance *SSHRemote) ConvertFilePath(filepath string) (newFilepath string) {

Callers 3

checkRemoteDirFunction · 0.80
checkRemoteDirFunction · 0.80

Calls 2

ConvertFilePathMethod · 0.95
ExeSSHCommandMethod · 0.95

Tested by

no test coverage detected