import (
"errors"
+ "internal/filepathlite"
"internal/godebug"
"internal/poll"
"internal/syscall/windows"
return &LinkError{"symlink", oldname, newname, err}
}
var o *uint16
- if isAbs(oldname) {
+ if filepathlite.IsAbs(oldname) {
o, err = syscall.UTF16PtrFromString(fixLongPath(oldname))
} else {
// Do not use fixLongPath on oldname for relative symlinks,
package os
import (
+ "internal/filepathlite"
"internal/syscall/windows"
"syscall"
)
return name
}
-func isAbs(path string) (b bool) {
- v := volumeName(path)
- if v == "" {
- return false
- }
- path = path[len(v):]
- if path == "" {
- return false
- }
- return IsPathSeparator(path[0])
-}
-
func volumeName(path string) (v string) {
if len(path) < 2 {
return ""
// The MSDN docs appear to say that a normal path that is 248 bytes long
// will work; empirically the path must be less then 248 bytes long.
pathLength := len(path)
- if !isAbs(path) {
+ if !filepathlite.IsAbs(path) {
// If the path is relative, we need to prepend the working directory
// plus a separator to the path before we can determine if it's too long.
// We don't want to call syscall.Getwd here, as that call is expensive to do
package os
import (
+ "internal/filepathlite"
"internal/godebug"
"internal/syscall/windows"
"sync"
// and set name from path.
func (fs *fileStat) saveInfoFromPath(path string) error {
fs.path = path
- if !isAbs(fs.path) {
+ if !filepathlite.IsAbs(fs.path) {
var err error
fs.path, err = syscall.FullPath(fs.path)
if err != nil {