跳到主要内容

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

浏览文件

fsutil_linux.go

34 行 · 736 B历史下载
1// SPDX-FileCopyrightText: Copyright The Lima Authors
2// SPDX-License-Identifier: Apache-2.0
3
4package fsutil
5
6import (
7 "errors"
8 "os"
9 "path/filepath"
10
11 "golang.org/x/sys/unix"
12)
13
14// IsNFS checks if the path is on NFS. If the path does not exist yet, it will walk
15// up parent directories until one exists, or it hits '/' or '.'.
16// Any other stat errors will cause IsNFS to fail.
17func IsNFS(path string) (bool, error) {
18 for len(path) > 1 {
19 _, err := os.Stat(path)
20 if err == nil {
21 break
22 }
23 if !errors.Is(err, os.ErrNotExist) {
24 return false, err
25 }
26 path = filepath.Dir(path)
27 }
28
29 var sf unix.Statfs_t
30 if err := unix.Statfs(path, &sf); err != nil {
31 return false, err
32 }
33 return sf.Type == unix.NFS_SUPER_MAGIC, nil
34}