package shared
import "tailscale.com/drive/driveimpl/shared"
Package shared contains types and functions shared by different drive packages.
Index ¶
- func Base(p string) string
- func CleanAndSplit(p string) []string
- func EscapeForXML(s string) string
- func IsRoot(p string) bool
- func Join(parts ...string) string
- func JoinEscaped(parts ...string) string
- func Normalize(p string) string
- func Parent(p string) string
- type DirFile
- func (d *DirFile) Close() error
- func (d *DirFile) Read(b []byte) (int, error)
- func (d *DirFile) Readdir(count int) ([]fs.FileInfo, error)
- func (d *DirFile) Seek(offset int64, whence int) (int64, error)
- func (d *DirFile) Stat() (fs.FileInfo, error)
- func (d *DirFile) Write(b []byte) (int, error)
- type StaticFileInfo
- func ReadOnlyDirInfo(name string, ts time.Time) *StaticFileInfo
- func RenamedFileInfo(ctx context.Context, name string, fi fs.FileInfo) *StaticFileInfo
- func (fi *StaticFileInfo) BirthTime(_ context.Context) (time.Time, error)
- func (fi *StaticFileInfo) IsDir() bool
- func (fi *StaticFileInfo) ModTime() time.Time
- func (fi *StaticFileInfo) Mode() os.FileMode
- func (fi *StaticFileInfo) Name() string
- func (fi *StaticFileInfo) Size() int64
- func (fi *StaticFileInfo) Sys() any
Functions ¶
func Base ¶
Base is like path.Base except that it returns "" for the root folder
func CleanAndSplit ¶
CleanAndSplit cleans the provided path p and splits it into its constituent parts. This is different from path.Split which just splits a path into prefix and suffix.
If p is empty or contains only path separators, CleanAndSplit returns a slice of length 1 whose only element is "".
func EscapeForXML ¶
EscapeForXML escapes the given string for use in XML text.
func IsRoot ¶
IsRoot determines whether a given path p is the root path, defined as either empty or "/".
func Join ¶
Join behaves like path.Join() but also includes a leading slash.
When parts are missing, the result is "/".
func JoinEscaped ¶
JoinEscaped is like Join but path escapes each part.
func Normalize ¶
Normalize normalizes the given path (e.g. dropping trailing slashes).
func Parent ¶
Parent extracts the parent of the given path.
Types ¶
type DirFile ¶
type DirFile struct { // Info provides the fs.FileInfo for this directory Info fs.FileInfo // LoadChildren is used to load the fs.FileInfos for this directory's // children. It is called at most once in order to support listing // children. LoadChildren func() ([]fs.FileInfo, error) // contains filtered or unexported fields }
DirFile implements webdav.File for a virtual directory. It mimics the behavior of an os.File that is pointing at a real directory.
func (*DirFile) Close ¶
Close implements interface webdav.File. It does nothing and never returns an error.
func (*DirFile) Read ¶
Read implements interface webdav.File. As this is a directory, it always fails with an fs.PathError.
func (*DirFile) Readdir ¶
Readdir implements interface webdav.File. It lazily loads information about children when it is called.
func (*DirFile) Seek ¶
Seek implements interface webdav.File. As this is a directory, it always fails with an fs.PathError.
func (*DirFile) Stat ¶
Stat implements interface webdav.File.
func (*DirFile) Write ¶
Write implements interface webdav.File. As this is a directory, it always fails with an fs.PathError.
type StaticFileInfo ¶
type StaticFileInfo struct { // Named controls Name() Named string // Sized controls Size() Sized int64 // Moded controls Mode() Moded os.FileMode // BirthedTime controls BirthTime() BirthedTime time.Time // BirthedTimeErr stores any error encountered when trying to get BirthTime BirthedTimeErr error // ModdedTime controls ModTime() ModdedTime time.Time // Dir controls IsDir() Dir bool }
StaticFileInfo implements a static fs.FileInfo
func ReadOnlyDirInfo ¶
func ReadOnlyDirInfo(name string, ts time.Time) *StaticFileInfo
ReadOnlyDirInfo returns a static fs.FileInfo for a read-only directory
func RenamedFileInfo ¶
func (*StaticFileInfo) BirthTime ¶
BirthTime implements webdav.BirthTimer
func (*StaticFileInfo) IsDir ¶
func (fi *StaticFileInfo) IsDir() bool
func (*StaticFileInfo) ModTime ¶
func (fi *StaticFileInfo) ModTime() time.Time
func (*StaticFileInfo) Mode ¶
func (fi *StaticFileInfo) Mode() os.FileMode
func (*StaticFileInfo) Name ¶
func (fi *StaticFileInfo) Name() string
func (*StaticFileInfo) Size ¶
func (fi *StaticFileInfo) Size() int64
func (*StaticFileInfo) Sys ¶
func (fi *StaticFileInfo) Sys() any
Source Files ¶
pathutil.go readonlydir.go stat.go xml.go
- Version
- v1.84.1 (latest)
- Published
- May 29, 2025
- Platform
- linux/amd64
- Imports
- 13 packages
- Last checked
- 2 hours ago –
Tools for package owners.