Movatterモバイル変換


[0]ホーム

URL:


Wayback Machine
458 captures
10 Apr 2011 - 22 Sep 2025
AprMAYAug
Previous capture25Next capture
201020112012
success
fail
COLLECTED BY
Organization:Alexa Crawls
Starting in 1996,Alexa Internet has been donating their crawl data to the Internet Archive. Flowing in every day, these data are added to theWayback Machine after an embargo period.
Collection:Alexa Crawls
Starting in 1996,Alexa Internet has been donating their crawl data to the Internet Archive. Flowing in every day, these data are added to theWayback Machine after an embargo period.
TIMESTAMPS
loading
The Wayback Machine - https://web.archive.org/web/20110525035625/http://golang.org:80/pkg/path/filepath/

The Go Programming Language

References:Packages|Commands|Specification

Package filepath

import "path/filepath"

Package filepath implements utility routines for manipulating filename pathsin a way compatible with the target operating system-defined file paths.

Package files

match.gopath.gopath_plan9.gopath_unix.gopath_windows.go

Constants

const (    Separator     = '/'// OS-specific path separator    ListSeparator = 0// OS-specific path list separator)
const (    Separator     = '\\'// OS-specific path separator    ListSeparator = ':'// OS-specific path list separator)
const (    Separator     = '/'// OS-specific path separator    ListSeparator = ':'// OS-specific path list separator)
const (    SeparatorString     = string(Separator)    ListSeparatorString = string(ListSeparator))

Variables

var ErrBadPattern = os.NewError("syntax error in pattern")

funcAbs

func Abs(path string) (string, os.Error)

Abs returns an absolute representation of path.If the path is not absolute it will be joined with the currentworking directory to turn it into an absolute path. The absolutepath name for a given file is not guaranteed to be unique.

funcBase

func Base(path string) string

Base returns the last element of path.Trailing path separators are removed before extracting the last element.If the path is empty, Base returns ".".If the path consists entirely of separators, Base returns a single separator.

funcClean

func Clean(path string) string

Clean returns the shortest path name equivalent to pathby purely lexical processing. It applies the following rulesiteratively until no further processing can be done:

1. Replace multiple Separator elements with a single one.2. Eliminate each . path name element (the current directory).3. Eliminate each inner .. path name element (the parent directory)   along with the non-.. element that precedes it.4. Eliminate .. elements that begin a rooted path:   that is, replace "/.." by "/" at the beginning of a path,        assuming Separator is '/'.

If the result of this process is an empty string, Cleanreturns the string ".".

See also Rob Pike, “Lexical File Names in Plan 9 orGetting Dot-Dot right,”http://plan9.bell-labs.com/sys/doc/lexnames.html

funcEvalSymlinks

func EvalSymlinks(path string) (string, os.Error)

EvalSymlinks returns the path name after the evaluation of any symboliclinks.If path is relative it will be evaluated relative to the current directory.

funcExt

func Ext(path string) string

Ext returns the file name extension used by path.The extension is the suffix beginning at the final dotin the final element of path; it is empty if there isno dot.

funcFromSlash

func FromSlash(path string) string

FromSlash returns the result of replacing each slash ('/') characterin path with a separator character.

funcGlob

func Glob(pattern string) (matches []string, err os.Error)

Glob returns the names of all files matching pattern or nilif there is no matching file. The syntax of patterns is the sameas in Match. The pattern may describe hierarchical names such as/usr/*/bin/ed (assuming the Separator is '/').The only possible error return occurs when the pattern is malformed.

funcIsAbs

func IsAbs(path string) bool

IsAbs returns true if the path is absolute.

funcJoin

func Join(elem ...string) string

Join joins any number of path elements into a single path, addinga Separator if necessary. All empty strings are ignored.

funcMatch

func Match(pattern, name string) (matched bool, err os.Error)

Match returns true if name matches the shell file name pattern.The pattern syntax is:

pattern:{ term }term:'*'         matches any sequence of non-Separator characters'?'         matches any single non-Separator character'[' [ '^' ] { character-range } ']'            character class (must be non-empty)c           matches character c (c != '*', '?', '\\', '[')'\\' c      matches character ccharacter-range:c           matches character c (c != '\\', '-', ']')'\\' c      matches character clo '-' hi   matches character c for lo <= c <= hi

Match requires pattern to match all of name, not just a substring.The only possible error return occurs when the pattern is malformed.

funcSplit

func Split(path string) (dir, file string)

Split splits path immediately following the final Separator,partitioning it into a directory and a file name components.If there are no separators in path, Split returns an empty baseand file set to path.

funcSplitList

func SplitList(path string) []string

SplitList splits a list of paths joined by the OS-specific ListSeparator.

funcToSlash

func ToSlash(path string) string

ToSlash returns the result of replacing each separator characterin path with a slash ('/') character.

funcWalk

func Walk(root string, v Visitor, errors chan<- os.Error)

Walk walks the file tree rooted at root, calling v.VisitDir orv.VisitFile for each directory or file in the tree, including root.If v.VisitDir returns false, Walk skips the directory's entries;otherwise it invokes itself for each directory entry in sorted order.An error reading a directory does not abort the Walk.If errors != nil, Walk sends each directory read errorto the channel. Otherwise Walk discards the error.

typeVisitor

Visitor methods are invoked for corresponding file tree entriesvisited by Walk. The parameter path is the full path of f relativeto root.

type Visitor interface {    VisitDir(path string, f *os.FileInfo) bool    VisitFile(path string, f *os.FileInfo)}

release.r57.1 8276. Except as noted, this content is licensed under aCreative Commons Attribution 3.0 License.


[8]ページ先頭

©2009-2025 Movatter.jp