返回 DeepSeek-Reasonix
workspace_path.go
根目录 / desktop / workspace_path.go
1 package main
2
3 import (
4 "os"
5 "path/filepath"
6 )
7
8 // ResolveWorkspacePathForTab returns the absolute local path represented by a
9 // workspace-relative path or a session-authorized external folder reference.
10 // Keeping this resolution in the backend ensures the renderer cannot mistake an
11 // external reference token for a child of the workspace root.
12 func (a *App) ResolveWorkspacePathForTab(tabID, rel string) (string, error) {
13 path, ok, err := a.workspaceOrExternalPathForTab(tabID, rel)
14 if err != nil {
15 return "", err
16 }
17 if !ok {
18 return "", os.ErrInvalid
19 }
20 abs, err := filepath.Abs(path)
21 if err != nil {
22 return "", err
23 }
24 return filepath.Clean(abs), nil
25 }
26
26 lines GO