Debian Codegraph @

src/path/filepath/symlink_plan9.go

raw
1 // Copyright 2022 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
4
5 package filepath
6
7 import (
8 "os"
9 "strings"
10 "syscall"
11 )
12
13 func evalSymlinks(path string) (string, error) {
14 // Plan 9 doesn't have symbolic links, so no need for substitutions.
15 if len(path) > 0 {
16 // Check validity of path
17 _, err := os.Lstat(path)
18 if err != nil {
19 // Return the same error value as on other operating systems.
20 if strings.Contains(err.Error(), "not a directory") {
21 err = syscall.ENOTDIR
22 }
23 return "", err
24 }
25 }
26 return Clean(path), nil
27 }