跳到主要内容

Claude Cage · 面向 Claude 的隔离开发环境,支持桌面工作台、多账号、远程部署与移动端连接。上游 Lee-xeo/Claude-Cage 完整源码镜像,非灵栈原创;主许可 MIT,第三方组件遵循各自许可。来源:https://github.com/Lee-xeo/Claude-Cage 。手动同步,不附带 Release 安装包。

浏览文件

envutil_windows.go

46 行 · 1.1 KB历史下载
1// SPDX-FileCopyrightText: Copyright The Lima Authors
2// SPDX-License-Identifier: Apache-2.0
3
4package envutil
5
6import (
7 "os"
8 "path/filepath"
9)
10
11// PlatformCommonToolDirs contains the common tool installation directories required on the host platform.
12var PlatformCommonToolDirs = []string{
13 qemuDir(),
14 `C:\msys64\usr\bin`,
15}
16
17// qemuDir returns the default QEMU installation directories under %PROGRAMFILES%.
18func qemuDir() string {
19 programfiles, ok := os.LookupEnv("PROGRAMFILES")
20 if !ok {
21 programfiles = `C:\Program Files`
22 }
23 qemu := filepath.Join(programfiles, "QEMU")
24 return qemu
25}
26
27// AppendDirsToPath appends specified directories to pathEnv
28// Only existing directories that are not already in PATH are added.
29func AppendDirsToPath(pathEnv string, dirs []string) string {
30 seen := make(map[string]struct{})
31 for _, entry := range filepath.SplitList(pathEnv) {
32 seen[entry] = struct{}{}
33 }
34 for _, dir := range dirs {
35 st, err := os.Stat(dir)
36 if err != nil || !st.IsDir() {
37 continue
38 }
39 if _, ok := seen[dir]; ok {
40 continue
41 }
42 seen[dir] = struct{}{}
43 pathEnv += string(filepath.ListSeparator) + dir
44 }
45 return pathEnv
46}