Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( ErrInvalidPath = errors.Error("invalid path: %s") ErrInvalidName = errors.Error("invalid name: %s") )
Functions ¶
func Base ¶
However: Base(p Path) returns the last part, i.e. for directories including the / at the end so joining Dir() and Base() will give the complete relative path
func Drive ¶
Drive returns the drive letter, followed by a : for a windows absolute path and an empty string for non windows paths
func Name ¶
returns the name (the part after the last slash) if p is a directory, the last slash will not be part of the name that means, that joining Dir() and Name() will not be a directory name, but a filename However: Base(p Path) returns the last part, i.e. for directories including the / at the end so joining Dir() and Base() will give the complete relative path
Types ¶
type Local ¶
type Local [2]string
func MustLocal ¶
MustLocal calls ParseLocal, panics if the later returns an error and returns the Local path otherwise
func MustWD ¶
func MustWD() Local
WD returns the working directory as an absolute path Local calls ParseLocal, panics if the later returns an error and returns the Absolute path otherwise
func ParseLocal ¶
ParseLocal parses local fs paths (they are always absolute). that basically means Unix and windows system paths and Windows UNC paths. a windows path might be entered the following ways: A: `C:\a\b\c\` (ending in a backslash means directory) B: `C:/a/b/c/` (ending in a slash means directory) C: `\\share\sub\directories\` (ending in a backslash means directory) D: `\\share/sub/directories/` (ending in a slash means directory) in case A and B the resulting Absolute path will be Head: C:/ Tail: a/b/c/ in case C and D the resulting Absolute path will be Head: \\share/ Tail: sub/directories/ if the given abs does not have the correct syntax or is not absolute, ParseLocal will return an error
func (Local) Join ¶
Join returns a new Absolute that has the same head but a tail that is the join of the old tail and the given parts within the parts, directories must end with a slash /
func (Local) ToLocString ¶
ToLocString transforms the given Local path into the local string notation. That means that the final path-seperator for a directory is dropped. Also the resulting string is absolute / complete and does not contain jumpers like . and .. (it is cleaned) Unix system paths are returned as is, just without a final /, if it is a directory Windows system paths are transformed by replacing the / with a backslash \ e.g. C:\a\b\c (the final backslash would also be dropped, if it is a directory) Windows UNC paths are also transformed by replacing the / with a backslash \ e.g. \\myshare\a\b\c if a is non of the supported paths, an empty string is returned
type Relative ¶
type Relative string
Relative is a relative path, i.e. a path that does neither start with a slash, nor with a schema.
func (Relative) Join ¶
Join returns a new relative path by joining the old one with the given parts. within the parts, directories must end with a slash /
type Remote ¶
func MustRemote ¶
MustRemote calls ParseRemote, panics if the later returns an error and returns the Remote path otherwise
func ParseRemote ¶
ParseRemote parses remote fs paths, i.e. urls (they are always absolute). the given url should not have querys, nor fragments