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

Method fileInfoInternal

pkg/wshrpc/wshremote/wshremote_file.go:337–357  ·  view source on GitHub ↗
(path string, extended bool)

Source from the content-addressed store, hash-verified

335}
336
337func (*ServerImpl) fileInfoInternal(path string, extended bool) (*wshrpc.FileInfo, error) {
338 cleanedPath := filepath.Clean(wavebase.ExpandHomeDirSafe(path))
339 finfo, err := os.Stat(cleanedPath)
340 if os.IsNotExist(err) {
341 return &wshrpc.FileInfo{
342 Path: wavebase.ReplaceHomeDir(path),
343 Dir: computeDirPart(path),
344 NotFound: true,
345 ReadOnly: checkIsReadOnly(cleanedPath, finfo, false),
346 SupportsMkdir: true,
347 }, nil
348 }
349 if err != nil {
350 return nil, fmt.Errorf("cannot stat file %q: %w", path, err)
351 }
352 rtn := statToFileInfo(cleanedPath, finfo, extended)
353 if extended {
354 rtn.ReadOnly = checkIsReadOnly(cleanedPath, finfo, true)
355 }
356 return rtn, nil
357}
358
359func resolvePaths(paths []string) string {
360 if len(paths) == 0 {

Callers 3

RemoteFileJoinCommandMethod · 0.95
RemoteFileInfoCommandMethod · 0.95

Calls 7

ExpandHomeDirSafeFunction · 0.92
ReplaceHomeDirFunction · 0.92
computeDirPartFunction · 0.85
checkIsReadOnlyFunction · 0.85
statToFileInfoFunction · 0.85
StatMethod · 0.80
CleanMethod · 0.45

Tested by

no test coverage detected