MCPcopy
hub / github.com/wavetermdev/waveterm / RemoteMkdirCommand

Method RemoteMkdirCommand

pkg/wshrpc/wshremote/wshremote_file.go:465–478  ·  view source on GitHub ↗
(ctx context.Context, path string)

Source from the content-addressed store, hash-verified

463}
464
465func (impl *ServerImpl) RemoteMkdirCommand(ctx context.Context, path string) error {
466 cleanedPath := filepath.Clean(wavebase.ExpandHomeDirSafe(path))
467 if stat, err := os.Stat(cleanedPath); err == nil {
468 if stat.IsDir() {
469 return fmt.Errorf("directory %q already exists", path)
470 } else {
471 return fmt.Errorf("cannot create directory %q, file exists at path", path)
472 }
473 }
474 if err := os.MkdirAll(cleanedPath, 0755); err != nil {
475 return fmt.Errorf("cannot create directory %q: %w", cleanedPath, err)
476 }
477 return nil
478}
479
480func (*ServerImpl) RemoteWriteFileCommand(ctx context.Context, data wshrpc.FileData) error {
481 var truncate, append bool

Callers

nothing calls this directly

Calls 4

ExpandHomeDirSafeFunction · 0.92
StatMethod · 0.80
CleanMethod · 0.45
IsDirMethod · 0.45

Tested by

no test coverage detected