/
githubmirror
/
rclone
Обзор
Документация
Войти
/
githubmirror
/
rclone
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
lib/file/unc_windows.go
31 строка
686 B
albertony
build: remove build constraint syntax for go 1.16 and older
18 апр 2024, 17:53
18 апр 2024, 17:53
68bf6aa
Код
Авторство
О чём код?
//go:build windows package file import ( "regexp" "strings" ) // Pattern to match a windows absolute path: "c:\" and similar var isAbsWinDrive = regexp.MustCompile(`^[a-zA-Z]\:\\`) // UNCPath converts an absolute Windows path to a UNC long path. // // It does nothing on non windows platforms func UNCPath(l string) string { // If prefix is "\\", we already have a UNC path or server. if strings.HasPrefix(l, `\\`) { // If already long path, just keep it if strings.HasPrefix(l, `\\?\`) { return l } // Trim "\\" from path and add UNC prefix. return `\\?\UNC\` + strings.TrimPrefix(l, `\\`) } if isAbsWinDrive.MatchString(l) { return `\\?\` + l } return l }