android.googlesource.com/platform/external/python/parse_type:tasks/_vendor/pathlib.py: [ master, ] |
---|
928: class Path(PurePath):
|
210: def _split_extended_path(self, s, ext_prefix=ext_namespace_prefix):
|
134: pathmod = ntpath
|
253: pathmod = posixpath
|
565: class PurePath(object):
|
844: def joinpath(self, *args):
|
915: class PurePosixPath(PurePath):
|
920: class PureWindowsPath(PurePath):
|
952: def _make_child_relpath(self, part):
|
1275: class PosixPath(Path, PurePosixPath):
|
1278: class WindowsPath(Path, PureWindowsPath):
|
537: class _PathParents(Sequence):
|
40: _getfinalpathname = None
|
45: "Path", "PosixPath", "WindowsPath",
|
67: """A flavour implements a particular (platform-specific) set of path
|
119: # Same drive => second path is relative to the first
|
122: # Second path is non-anchored (common case)
|
162: prefix, part = self._split_extended_path(part)
|
169: # is a UNC path:
|
176: # a UNC path can't have two slashes in a row
|
201: def resolve(self, path):
|
202: s = str(path)
|
221: # Turn back an extended path into a normal DOS-like path
|
222: return self._split_extended_path(s)[1]
|
236: def make_uri(self, path):
|
238: drive = path.drive
|
240: # It's a path on a local drive => 'file:///c:/a/b'
|
241: rest = path.as_posix()[2:].lstrip('/')
|
245: # It's a path on a network drive => 'file://host/share/a/b'
|
246: return 'file:' + urlquote_from_bytes(path.as_posix().encode('utf-8'))
|
260: # According to POSIX path resolution:
|
278: def resolve(self, path):
|
280: accessor = path._accessor
|
282: def _resolve(path, rest):
|
284: path = ''
|
292: path, _, _ = path.rpartition(sep)
|
294: newpath = path + sep + name
|
296: # Already seen this path
|
297: path = seen[newpath]
|
298: if path is not None:
|
310: path = newpath
|
313: path = _resolve(path, target)
|
314: seen[newpath] = path # resolved symlink
|
316: return path
|
317: # NOTE: according to POSIX, getcwd() cannot contain path components
|
319: base = '' if path.is_absolute() else os.getcwd()
|
320: return _resolve(base, str(path)) or sep
|
325: def make_uri(self, path):
|
326: # We represent the path using the local filesystem encoding,
|
328: bpath = bytes(path)
|
397: def readlink(self, path):
|
398: return os.readlink(path)
|
433: raise ValueError("Invalid pattern: '**' can only be an entire path component")
|
446: of a given path."""
|
455: def select_from(self, parent_path):
|
456: """Iterate over all child paths of `parent_path` matched by this
|
457: selector. This can contain parent_path itself."""
|
458: path_cls = type(parent_path)
|
459: is_dir = path_cls.is_dir
|
460: exists = path_cls.exists
|
461: listdir = parent_path._accessor.listdir
|
462: return self._select_from(parent_path, is_dir, exists, listdir)
|
467: def _select_from(self, parent_path, is_dir, exists, listdir):
|
468: yield parent_path
|
477: def _select_from(self, parent_path, is_dir, exists, listdir):
|
478: if not is_dir(parent_path):
|
480: path = parent_path._make_child_relpath(self.name)
|
481: if exists(path):
|
482: for p in self.successor._select_from(path, is_dir, exists, listdir):
|
492: def _select_from(self, parent_path, is_dir, exists, listdir):
|
493: if not is_dir(parent_path):
|
495: cf = parent_path._flavour.casefold
|
496: for name in listdir(parent_path):
|
499: path = parent_path._make_child_relpath(name)
|
500: for p in self.successor._select_from(path, is_dir, exists, listdir):
|
509: def _iterate_directories(self, parent_path, is_dir, listdir):
|
510: yield parent_path
|
511: for name in listdir(parent_path):
|
512: path = parent_path._make_child_relpath(name)
|
513: if is_dir(path):
|
514: for p in self._iterate_directories(path, is_dir, listdir):
|
517: def _select_from(self, parent_path, is_dir, exists, listdir):
|
518: if not is_dir(parent_path):
|
524: for starting_point in self._iterate_directories(parent_path, is_dir, listdir):
|
539: of a path. Don't try to construct it yourself."""
|
542: def __init__(self, path):
|
544: self._pathcls = type(path)
|
545: self._drv = path._drv
|
546: self._root = path._root
|
547: self._parts = path._parts
|
566: """PurePath represents a filesystem path and offers operations which
|
579: PurePath objects. The strings and path objects are combined so as
|
580: to yield a canonicalized path, which is incorporated into the
|
588: # Using the parts tuple helps share interned path parts
|
604: "argument should be a path or str object, not %r"
|
639: # Overriden in concrete Path
|
649: """Return the string representation of the path, suitable for
|
659: """Return the string representation of the path with forward (/)
|
665: """Return the bytes representation of the path. This is only
|
675: """Return the path as a 'file' URI."""
|
677: raise ValueError("relative path can't be expressed as a file URI")
|
725: doc="""The drive prefix (letter or UNC path), if any.""")
|
728: doc="""The root of the path, if any.""")
|
738: """The final path component, if any."""
|
765: """The final path component, minus its last suffix."""
|
774: """Return a new path with the file name changed."""
|
781: """Return a new path with the file suffix changed (or added, if none)."""
|
801: """Return the relative path to another path identified by the passed
|
803: a subpath of the other path), raise ValueError.
|
807: # Path('c:/').relative_to('c:') gives Path('/')
|
808: # Path('c:/').relative_to('/') raise ValueError
|
835: components in the filesystem path."""
|
845: """Combine this path with one or several arguments, and return a
|
846: new path representing either a subpath (if all arguments are relative
|
847: paths) or a totally different path (if one of the arguments is
|
864: """The logical parent of the path."""
|
874: """A sequence of this path's logical parents."""
|
878: """True if the path is absolute (has both a root and, if applicable,
|
885: """Return True if the path contains one of the special names reserved
|
889: def match(self, path_pattern):
|
891: Return True if this path matches the given pattern.
|
894: path_pattern = cf(path_pattern)
|
895: drv, root, pat_parts = self._flavour.parse_parts((path_pattern,))
|
934: if cls is Path:
|
954: # a single part relative to this path.
|
964: Open the file pointed by this path and return a file descriptor,
|
973: """Return a new path pointing to the current working directory
|
984: # Yielding a path object for these makes little sense
|
1013: """Return an absolute version of this path. This function works
|
1014: even if the path doesn't point to anything.
|
1017: Use resolve() to get the canonical path to a file.
|
1030: Make the path absolute, resolving all symlinks on the way and also
|
1037: # the path doesn't exist or is forbidden
|
1040: # Now we have no symlinks in the path, it's safe to normalize it.
|
1048: Return the result of the stat() system call on this path, like
|
1070: Open the file pointed by this path and return a file object, as
|
1115: Change the permissions of the path, like os.chmod().
|
1121: Like chmod(), except if the path points to a symlink, the symlink's
|
1129: If the path is a directory, use rmdir() instead.
|
1141: Like stat(), except if the path points to a symlink, the symlink's
|
1148: Rename this path to the given path.
|
1154: Rename this path to the given path, clobbering the existing
|
1164: Make this path a symlink pointing to the given path.
|
1173: Whether this path exists.
|
1185: Whether this path is a directory.
|
1192: # Path doesn't exist or is a broken symlink
|
1198: Whether this path is a regular file (also True for symlinks pointing
|
1206: # Path doesn't exist or is a broken symlink
|
1212: Whether this path is a symbolic link.
|
1219: # Path doesn't exist
|
1224: Whether this path is a block device.
|
1231: # Path doesn't exist or is a broken symlink
|
1237: Whether this path is a character device.
|
1244: # Path doesn't exist or is a broken symlink
|
1250: Whether this path is a FIFO.
|
1257: # Path doesn't exist or is a broken symlink
|
1263: Whether this path is a socket.
|
1270: # Path doesn't exist or is a broken symlink
|
4: import ntpath
|
6: import posixpath
|
44: "PurePath", "PurePosixPath", "PureWindowsPath",
|
111: Join the two paths represented by the respective
|
128: # Reference for Windows paths can be found at
|
150: # Interesting findings about extended paths:
|
153: # - extended paths are always absolute; "relative" extended paths will
|
160: # XXX extended paths should also disable the collapsing of "."
|
227: # We err on the side of caution and return True for paths which are
|
232: # UNC paths are never reserved
|
262: # "A pathname that begins with two successive slashes may be
|
295: if newpath in seen:
|
302: raise RuntimeError("Symlink loop from %r" % newpath)
|
305: target = accessor.readlink(newpath)
|
312: seen[newpath] = None # not resolved symlink
|
329: return 'file://' + urlquote_from_bytes(bpath)
|
338: accessing paths on the filesystem."""
|
345: def wrapped(pathobj, *args):
|
346: return strfunc(str(pathobj), *args)
|
351: def wrapped(pathobjA, pathobjB, *args):
|
352: return strfunc(str(pathobjA), str(pathobjB), *args)
|
368: def lchmod(self, pathobj, mode):
|
540: __slots__ = ('_pathcls', '_drv', '_root', '_parts')
|
558: return self._pathcls._from_parsed_parts(self._drv, self._root,
|
562: return "<{0}.parents>".format(self._pathcls.__name__)
|
568: instantiating a PurePath will return either a PurePosixPath or a
|
569: PureWindowsPath object. You can also instantiate either of these classes
|
578: """Construct a PurePath from one or several strings and or existing
|
581: new PurePath object.
|
583: if cls is PurePath:
|
584: cls = PureWindowsPath if os.name == 'nt' else PurePosixPath
|
589: # when pickling related paths.
|
598: if isinstance(a, PurePath):
|
690: if not isinstance(other, PurePath):
|
705: if not isinstance(other, PurePath) or self._flavour is not other._flavour:
|
710: if not isinstance(other, PurePath) or self._flavour is not other._flavour:
|
715: if not isinstance(other, PurePath) or self._flavour is not other._flavour:
|
720: if not isinstance(other, PurePath) or self._flavour is not other._flavour:
|
875: return _PathParents(self)
|
935: cls = WindowsPath if os.name == 'nt' else PosixPath
|
980: result for the special paths '.' and '..'.
|
986: yield self._make_child_relpath(name)
|
1041: normed = self._flavour.pathmod.normpath(s)
|
1193: # (see https://bitbucket.org/pitrou/pathlib/issue/12/)
|
1207: # (see https://bitbucket.org/pitrou/pathlib/issue/12/)
|
1232: # (see https://bitbucket.org/pitrou/pathlib/issue/12/)
|
1245: # (see https://bitbucket.org/pitrou/pathlib/issue/12/)
|
1258: # (see https://bitbucket.org/pitrou/pathlib/issue/12/)
|
1271: # (see https://bitbucket.org/pitrou/pathlib/issue/12/)
|
37: from nt import _getfinalpathname
|
205: if _getfinalpathname is not None:
|
206: return self._ext_to_normal(_getfinalpathname(s))
|
1023: # use nt._getfullpathname())
|
github.com/apache/incubator-teaclave-sgx-sdk:sgx_tstd/src/path.rs: [ master, ] |
---|
581: path: &'a [u8],
|
1747: impl ToOwned for Path {
|
1834: pub struct Path {
|
1847: impl Path {
|
2739: impl AsRef<OsStr> for Path {
|
2746: impl fmt::Debug for Path {
|
2773: path: &'a Path,
|
2788: impl cmp::PartialEq for Path {
|
2795: impl Hash for Path {
|
2845: impl cmp::Eq for Path {}
|
2847: impl cmp::PartialOrd for Path {
|
2854: impl cmp::Ord for Path {
|
2861: impl AsRef<Path> for Path {
|
2919: impl<'a> IntoIterator for &'a Path {
|
674: pub fn as_path(&self) -> &'a Path {
|
816: pub fn as_path(&self) -> &'a Path {
|
1185: pub fn as_path(&self) -> &Path {
|
1434: pub fn into_boxed_path(self) -> Box<Path> {
|
1123: pub struct PathBuf {
|
1127: impl PathBuf {
|
1506: impl Clone for PathBuf {
|
1542: impl From<Box<Path>> for PathBuf {
|
1570: impl<T: ?Sized + AsRef<OsStr>> From<&T> for PathBuf {
|
1580: impl From<OsString> for PathBuf {
|
1600: impl From<String> for PathBuf {
|
1610: impl FromStr for PathBuf {
|
1619: impl<P: AsRef<Path>> iter::FromIterator<P> for PathBuf {
|
1627: impl<P: AsRef<Path>> iter::Extend<P> for PathBuf {
|
1638: impl fmt::Debug for PathBuf {
|
1644: impl ops::Deref for PathBuf {
|
1652: impl Borrow<Path> for PathBuf {
|
1659: impl Default for PathBuf {
|
1699: impl<'a> From<Cow<'a, Path>> for PathBuf {
|
1759: impl cmp::PartialEq for PathBuf {
|
1766: impl Hash for PathBuf {
|
1772: impl cmp::Eq for PathBuf {}
|
1774: impl cmp::PartialOrd for PathBuf {
|
1781: impl cmp::Ord for PathBuf {
|
1788: impl AsRef<OsStr> for PathBuf {
|
2903: impl AsRef<Path> for PathBuf {
|
2910: impl<'a> IntoIterator for &'a PathBuf {
|
1963: pub fn to_path_buf(&self) -> PathBuf {
|
2732: pub fn into_path_buf(self: Box<Path>) -> PathBuf {
|
18: //! Cross-platform path manipulation.
|
20: //! This module provides two types, [`PathBuf`] and [`Path`] (akin to [`String`]
|
23: //! on strings according to the local platform's path syntax.
|
26: //! returned by the [`components`] method on [`Path`]. [`Component`]s roughly
|
27: //! correspond to the substrings between path separators (`/` or `\`). You can
|
28: //! reconstruct an equivalent path from components with the [`push`] method on
|
34: //! Unless otherwise indicated path methods that do not access the filesystem,
|
35: //! such as [`Path::starts_with`] and [`Path::ends_with`], are case sensitive no
|
41: //! Path manipulation includes both parsing components from slices and building
|
44: //! To parse a path, you can create a [`Path`] slice from a [`str`]
|
48: //! use std::path::Path;
|
51: //! let path = Path::new("/tmp/foo/bar.txt");
|
53: //! let parent = path.parent();
|
54: //! assert_eq!(parent, Some(Path::new("/tmp/foo")));
|
56: //! let file_stem = path.file_stem();
|
59: //! let extension = path.extension();
|
66: //! use std::path::PathBuf;
|
69: //! let mut path = PathBuf::from("c:\\");
|
71: //! path.push("windows");
|
72: //! path.push("system32");
|
74: //! path.set_extension("dll");
|
78: //! let path: PathBuf = ["c:\\", "windows", "system32.dll"].iter().collect();
|
81: //! [`components`]: Path::components
|
103: use crate::sys::path::{is_sep_byte, is_verbatim_sep, parse_prefix, MAIN_SEP_STR};
|
119: /// Windows path prefixes, e.g., `C:` or `\\server\share`.
|
121: /// Windows uses a variety of path prefix styles, including references to drive
|
123: /// others. In addition, some path prefixes are "verbatim" (i.e., prefixed with
|
130: /// use std::path::{Component, Path, Prefix};
|
131: /// use std::path::Prefix::*;
|
134: /// fn get_path_prefix(s: &str) -> Prefix {
|
135: /// let path = Path::new(s);
|
136: /// match path.components().next().unwrap() {
|
144: /// get_path_prefix(r"\\?\pictures\kittens"));
|
146: /// get_path_prefix(r"\\?\UNC\server\share"));
|
147: /// assert_eq!(VerbatimDisk(b'C'), get_path_prefix(r"\\?\c:\"));
|
149: /// get_path_prefix(r"\\.\BrainInterface"));
|
151: /// get_path_prefix(r"\\server\share"));
|
152: /// assert_eq!(Disk(b'C'), get_path_prefix(r"C:\Users\Rust\Pictures\Ferris"));
|
216: /// use std::path::Prefix::*;
|
248: /// Determines whether the character is one of the permitted path
|
254: /// use std::path;
|
256: /// assert!(path::is_separator('/')); // '/' works for both Unix and Windows
|
257: /// assert!(!path::is_separator('❤'));
|
264: /// The primary separator of path components for the current platform.
|
267: pub const MAIN_SEPARATOR: char = crate::sys::path::MAIN_SEP;
|
269: /// The primary separator of path components for the current platform.
|
272: pub const MAIN_SEPARATOR_STR: &str = crate::sys::path::MAIN_SEP_STR;
|
321: let path = if let Some(p) = prefix { &s[p.len()..] } else { s };
|
322: !path.is_empty() && is_sep_byte(path[0])
|
369: /// front and back of the path each keep track of what parts of the path have
|
372: /// Going front to back, a path is made up of a prefix, a starting
|
382: /// A structure wrapping a Windows path prefix as well as its unparsed string
|
398: /// use std::path::{Component, Path, Prefix};
|
401: /// let path = Path::new(r"c:\you\later\");
|
402: /// match path.components().next().unwrap() {
|
470: /// A single component of a path.
|
472: /// A `Component` roughly corresponds to a substring between path separators
|
476: /// created by the [`components`](Path::components) method on [`Path`].
|
481: /// use std::path::{Component, Path};
|
483: /// let path = Path::new("/tmp/foo/bar.txt");
|
484: /// let components = path.components().collect::<Vec<_>>();
|
495: /// A Windows path prefix, e.g., `C:` or `\\server\share`.
|
505: /// It represents a separator that designates that a path starts from root.
|
527: /// use std::path::Path;
|
529: /// let path = Path::new("./tmp/foo/bar.txt");
|
530: /// let components: Vec<_> = path.components().map(|comp| comp.as_os_str()).collect();
|
540: Component::Normal(path) => path,
|
552: impl AsRef<Path> for Component<'_> {
|
554: fn as_ref(&self) -> &Path {
|
559: /// An iterator over the [`Component`]s of a [`Path`].
|
561: /// This `struct` is created by the [`components`] method on [`Path`].
|
567: /// use std::path::Path;
|
569: /// let path = Path::new("/tmp/foo/bar.txt");
|
571: /// for component in path.components() {
|
576: /// [`components`]: Path::components
|
580: // The path left to parse components from
|
586: // true if path *physically* has a root separator; for most Windows
|
597: /// An iterator over the [`Component`]s of a [`Path`], as [`OsStr`] slices.
|
599: /// This `struct` is created by the [`iter`] method on [`Path`].
|
602: /// [`iter`]: Path::iter
|
611: struct DebugHelper<'a>(&'a Path);
|
619: f.debug_tuple("Components").field(&DebugHelper(self.as_path())).finish()
|
641: // Given the iteration so far, how much of the pre-State::Body path is left?
|
660: /// Extracts a slice corresponding to the portion of the path remaining for iteration.
|
665: /// use std::path::Path;
|
667: /// let mut components = Path::new("/tmp/foo/bar.txt").components();
|
671: /// assert_eq!(Path::new("foo/bar.txt"), components.as_path());
|
682: unsafe { Path::from_u8_slice(comps.path) }
|
685: /// Is the *original* path rooted?
|
698: /// Should the normalized path include a leading . ?
|
703: let mut iter = self.path[self.prefix_len()..].iter();
|
711: // parse a given byte sequence into the corresponding path component
|
716: // the beginning of a path, which is treated
|
728: let (extra, comp) = match self.path.iter().position(|b| self.is_sep_byte(*b)) {
|
729: None => (0, self.path),
|
730: Some(i) => (1, &self.path[..i]),
|
740: let (extra, comp) = match self.path[start..].iter().rposition(|b| self.is_sep_byte(*b)) {
|
741: None => (0, &self.path[start..]),
|
742: Some(i) => (1, &self.path[start + i + 1..]),
|
749: while !self.path.is_empty() {
|
754: self.path = &self.path[size..];
|
761: while self.path.len() > self.len_before_body() {
|
766: self.path = &self.path[..self.path.len() - size];
|
772: impl AsRef<Path> for Components<'_> {
|
774: fn as_ref(&self) -> &Path {
|
775: self.as_path()
|
782: self.as_path().as_os_str()
|
788: struct DebugHelper<'a>(&'a Path);
|
796: f.debug_tuple("Iter").field(&DebugHelper(self.as_path())).finish()
|
801: /// Extracts a slice corresponding to the portion of the path remaining for iteration.
|
806: /// use std::path::Path;
|
808: /// let mut iter = Path::new("/tmp/foo/bar.txt").iter();
|
812: /// assert_eq!(Path::new("foo/bar.txt"), iter.as_path());
|
817: self.inner.as_path()
|
821: impl AsRef<Path> for Iter<'_> {
|
823: fn as_ref(&self) -> &Path {
|
824: self.as_path()
|
831: self.as_path().as_os_str()
|
861: debug_assert!(self.prefix_len() <= self.path.len());
|
862: let raw = &self.path[..self.prefix_len()];
|
863: self.path = &self.path[self.prefix_len()..];
|
875: debug_assert!(!self.path.is_empty());
|
876: self.path = &self.path[1..];
|
883: debug_assert!(!self.path.is_empty());
|
884: self.path = &self.path[1..];
|
888: State::Body if !self.path.is_empty() => {
|
890: self.path = &self.path[size..];
|
909: State::Body if self.path.len() > self.len_before_body() => {
|
911: self.path = &self.path[..self.path.len() - size];
|
922: self.path = &self.path[..self.path.len() - 1];
|
929: self.path = &self.path[..self.path.len() - 1];
|
936: raw: unsafe { u8_slice_as_os_str(self.path) },
|
956: let Components { path: _, front: _, back: _, has_physical_root: _, prefix: _ } = self;
|
958: // Fast path for exact matches, e.g. for hashmap lookups.
|
960: // either be covered by the `path` buffer or are only relevant for `prefix_verbatim()`.
|
961: if self.path.len() == other.path.len()
|
969: if self.path == other.path {
|
996: // Fast path for long shared prefixes
|
1001: // otherwise do it on the full path
|
1003: // The fast path isn't taken for paths with a PrefixComponent to avoid backtracking into
|
1007: let first_difference = match left.path.iter().zip(right.path).position(|(&a, &b)| a != b) {
|
1008: None if left.path.len() == right.path.len() => return cmp::Ordering::Equal,
|
1009: None => left.path.len().min(right.path.len()),
|
1014: left.path[..first_difference].iter().rposition(|&b| left.is_sep_byte(b))
|
1017: left.path = &left.path[mismatched_component_start..];
|
1019: right.path = &right.path[mismatched_component_start..];
|
1027: /// An iterator over [`Path`] and its ancestors.
|
1029: /// This `struct` is created by the [`ancestors`] method on [`Path`].
|
1035: /// use std::path::Path;
|
1037: /// let path = Path::new("/foo/bar");
|
1039: /// for ancestor in path.ancestors() {
|
1044: /// [`ancestors`]: Path::ancestors
|
1048: next: Option<&'a Path>,
|
1052: type Item = &'a Path;
|
1057: self.next = next.and_then(Path::parent);
|
1068: /// An owned, mutable path (akin to [`String`]).
|
1071: /// the path in place. It also implements [`Deref`] to [`Path`], meaning that
|
1072: /// all methods on [`Path`] slices are available on `PathBuf` values as well.
|
1086: /// use std::path::PathBuf;
|
1088: /// let mut path = PathBuf::new();
|
1090: /// path.push(r"C:\");
|
1091: /// path.push("windows");
|
1092: /// path.push("system32");
|
1094: /// path.set_extension("dll");
|
1101: /// use std::path::PathBuf;
|
1103: /// let path: PathBuf = [r"C:\", "windows", "system32.dll"].iter().collect();
|
1110: /// use std::path::PathBuf;
|
1112: /// let path = PathBuf::from(r"C:\windows\system32.dll");
|
1138: /// use std::path::PathBuf;
|
1140: /// let path = PathBuf::new();
|
1154: /// use std::path::PathBuf;
|
1156: /// let mut path = PathBuf::with_capacity(10);
|
1157: /// let capacity = path.capacity();
|
1160: /// path.push(r"C:\");
|
1162: /// assert_eq!(capacity, path.capacity());
|
1172: /// Coerces to a [`Path`] slice.
|
1177: /// use std::path::{Path, PathBuf};
|
1180: /// assert_eq!(Path::new("/test"), p.as_path());
|
1189: /// Extends `self` with `path`.
|
1191: /// If `path` is absolute, it replaces the current path.
|
1195: /// * if `path` has a root but no prefix (e.g., `\windows`), it
|
1197: /// * if `path` has a prefix but no root, it replaces `self`.
|
1199: /// and `path` is not empty, the new path is normalized: all references
|
1204: /// Pushing a relative path extends the existing path:
|
1207: /// use std::path::PathBuf;
|
1209: /// let mut path = PathBuf::from("/tmp");
|
1210: /// path.push("file.bk");
|
1211: /// assert_eq!(path, PathBuf::from("/tmp/file.bk"));
|
1214: /// Pushing an absolute path replaces the existing path:
|
1217: /// use std::path::PathBuf;
|
1219: /// let mut path = PathBuf::from("/tmp");
|
1220: /// path.push("/etc");
|
1221: /// assert_eq!(path, PathBuf::from("/etc"));
|
1223: pub fn push<P: AsRef<Path>>(&mut self, path: P) {
|
1224: self._push(path.as_ref())
|
1227: fn _push(&mut self, path: &Path) {
|
1235: && comps.prefix_len() == comps.path.len()
|
1241: // absolute `path` replaces `self`
|
1242: if path.is_absolute() || path.prefix().is_some() {
|
1246: } else if comps.prefix_verbatim() && !path.inner.is_empty() {
|
1248: for c in path.components() {
|
1285: // `path` has a root but no prefix, e.g., `\windows` (Windows only)
|
1286: } else if path.has_root() {
|
1290: // `path` is a pure relative path
|
1295: self.inner.push(path);
|
1303: /// [`self.parent`]: Path::parent
|
1308: /// use std::path::{Path, PathBuf};
|
1313: /// assert_eq!(Path::new("/spirited"), p);
|
1315: /// assert_eq!(Path::new("/"), p);
|
1333: /// `file_name`. The new path will be a sibling of the original path.
|
1336: /// [`self.file_name`]: Path::file_name
|
1342: /// use std::path::PathBuf;
|
1372: /// [`self.file_name`]: Path::file_name
|
1373: /// [`self.extension`]: Path::extension
|
1378: /// use std::path::{Path, PathBuf};
|
1383: /// assert_eq!(Path::new("/feel/the.force"), p.as_path());
|
1386: /// assert_eq!(Path::new("/feel/the.dark_side"), p.as_path());
|
1420: /// use std::path::PathBuf;
|
1431: /// Converts this `PathBuf` into a [boxed](Box) [`Path`].
|
1435: let rw = Box::into_raw(self.inner.into_boxed_os_str()) as *mut Path;
|
1518: impl From<&Path> for Box<Path> {
|
1519: /// Creates a boxed [`Path`] from a reference.
|
1521: /// This will allocate and clone `path` to it.
|
1522: fn from(path: &Path) -> Box<Path> {
|
1523: let boxed: Box<OsStr> = path.inner.into();
|
1524: let rw = Box::into_raw(boxed) as *mut Path;
|
1529: impl From<Cow<'_, Path>> for Box<Path> {
|
1530: /// Creates a boxed [`Path`] from a clone-on-write pointer.
|
1534: fn from(cow: Cow<'_, Path>) -> Box<Path> {
|
1536: Cow::Borrowed(path) => Box::from(path),
|
1537: Cow::Owned(path) => Box::from(path),
|
1543: /// Converts a <code>[Box]<[Path]></code> into a [`PathBuf`].
|
1547: fn from(boxed: Box<Path>) -> PathBuf {
|
1548: boxed.into_path_buf()
|
1552: impl From<PathBuf> for Box<Path> {
|
1553: /// Converts a [`PathBuf`] into a <code>[Box]<[Path]></code>.
|
1558: fn from(p: PathBuf) -> Box<Path> {
|
1559: p.into_boxed_path()
|
1563: impl Clone for Box<Path> {
|
1566: self.to_path_buf().into_boxed_path()
|
1595: fn from(path_buf: PathBuf) -> OsString {
|
1596: path_buf.inner
|
1645: type Target = Path;
|
1647: fn deref(&self) -> &Path {
|
1648: Path::new(&self.inner)
|
1654: fn borrow(&self) -> &Path {
|
1666: impl<'a> From<&'a Path> for Cow<'a, Path> {
|
1668: /// [`Path`].
|
1672: fn from(s: &'a Path) -> Cow<'a, Path> {
|
1677: impl<'a> From<PathBuf> for Cow<'a, Path> {
|
1683: fn from(s: PathBuf) -> Cow<'a, Path> {
|
1688: impl<'a> From<&'a PathBuf> for Cow<'a, Path> {
|
1694: fn from(p: &'a PathBuf) -> Cow<'a, Path> {
|
1695: Cow::Borrowed(p.as_path())
|
1700: /// Converts a clone-on-write pointer to an owned path.
|
1704: fn from(p: Cow<'a, Path>) -> Self {
|
1709: impl From<PathBuf> for Arc<Path> {
|
1710: /// Converts a [`PathBuf`] into an <code>[Arc]<[Path]></code> by moving the [`PathBuf`] data
|
1713: fn from(s: PathBuf) -> Arc<Path> {
|
1715: unsafe { Arc::from_raw(Arc::into_raw(arc) as *const Path) }
|
1719: impl From<&Path> for Arc<Path> {
|
1720: /// Converts a [`Path`] into an [`Arc`] by copying the [`Path`] data into a new [`Arc`] buffer.
|
1722: fn from(s: &Path) -> Arc<Path> {
|
1724: unsafe { Arc::from_raw(Arc::into_raw(arc) as *const Path) }
|
1728: impl From<PathBuf> for Rc<Path> {
|
1729: /// Converts a [`PathBuf`] into an <code>[Rc]<[Path]></code> by moving the [`PathBuf`] data into
|
1732: fn from(s: PathBuf) -> Rc<Path> {
|
1734: unsafe { Rc::from_raw(Rc::into_raw(rc) as *const Path) }
|
1738: impl From<&Path> for Rc<Path> {
|
1739: /// Converts a [`Path`] into an [`Rc`] by copying the [`Path`] data into a new [`Rc`] buffer.
|
1741: fn from(s: &Path) -> Rc<Path> {
|
1743: unsafe { Rc::from_raw(Rc::into_raw(rc) as *const Path) }
|
1751: self.to_path_buf()
|
1768: self.as_path().hash(h)
|
1795: /// A slice of a path (akin to [`str`]).
|
1797: /// This type supports a number of operations for inspecting a path, including
|
1798: /// breaking the path into its components (separated by `/` on Unix and by either
|
1799: /// `/` or `\` on Windows), extracting the file name, determining whether the path
|
1812: /// use std::path::Path;
|
1816: /// let path = Path::new("./foo/bar.txt");
|
1818: /// let parent = path.parent();
|
1819: /// assert_eq!(parent, Some(Path::new("./foo")));
|
1821: /// let file_stem = path.file_stem();
|
1824: /// let extension = path.extension();
|
1827: #[cfg_attr(not(test), rustc_diagnostic_item = "Path")]
|
1829: // `Path::new` current implementation relies
|
1830: // on `Path` being layout-compatible with `OsStr`.
|
1831: // When attribute privacy is implemented, `Path` should be annotated as `#[repr(transparent)]`.
|
1832: // Anyway, `Path` representation and layout are considered implementation detail, are
|
1838: /// An error returned from [`Path::strip_prefix`] if the prefix was not found.
|
1840: /// This `struct` is created by the [`strip_prefix`] method on [`Path`].
|
1843: /// [`strip_prefix`]: Path::strip_prefix
|
1848: // The following (private!) function allows construction of a path from a u8
|
1850: unsafe fn from_u8_slice(s: &[u8]) -> &Path {
|
1851: Path::new(u8_slice_as_os_str(s))
|
1858: /// Directly wraps a string slice as a `Path` slice.
|
1865: /// use std::path::Path;
|
1867: /// Path::new("foo.txt");
|
1870: /// You can create `Path`s from `String`s, or even other `Path`s:
|
1873: /// use std::path::Path;
|
1876: /// let from_string = Path::new(&string);
|
1877: /// let from_path = Path::new(&from_string);
|
1878: /// assert_eq!(from_string, from_path);
|
1880: pub fn new<S: AsRef<OsStr> + ?Sized>(s: &S) -> &Path {
|
1881: unsafe { &*(s.as_ref() as *const OsStr as *const Path) }
|
1889: /// use std::path::Path;
|
1891: /// let os_str = Path::new("foo.txt").as_os_str();
|
1900: /// Yields a [`&str`] slice if the `Path` is valid unicode.
|
1911: /// use std::path::Path;
|
1913: /// let path = Path::new("foo.txt");
|
1914: /// assert_eq!(path.to_str(), Some("foo.txt"));
|
1923: /// Converts a `Path` to a [`Cow<str>`].
|
1932: /// Calling `to_string_lossy` on a `Path` with valid unicode:
|
1935: /// use std::path::Path;
|
1937: /// let path = Path::new("foo.txt");
|
1938: /// assert_eq!(path.to_string_lossy(), "foo.txt");
|
1941: /// Had `path` contained invalid unicode, the `to_string_lossy` call might
|
1950: /// Converts a `Path` to an owned [`PathBuf`].
|
1955: /// use std::path::Path;
|
1957: /// let path_buf = Path::new("foo.txt").to_path_buf();
|
1958: /// assert_eq!(path_buf, std::path::PathBuf::from("foo.txt"));
|
1967: /// Returns `true` if the `Path` is absolute, i.e., if it is independent of
|
1970: /// * On Unix, a path is absolute if it starts with the root, so
|
1973: /// * On Windows, a path is absolute if it has a prefix and starts with the
|
1979: /// use std::path::Path;
|
1981: /// assert!(!Path::new("foo.txt").is_absolute());
|
1984: /// [`has_root`]: Path::has_root
|
1991: /// Returns `true` if the `Path` is relative, i.e., not absolute.
|
1998: /// use std::path::Path;
|
2000: /// assert!(Path::new("foo.txt").is_relative());
|
2003: /// [`is_absolute`]: Path::is_absolute
|
2014: /// Returns `true` if the `Path` has a root.
|
2016: /// * On Unix, a path has a root if it begins with `/`.
|
2018: /// * On Windows, a path has a root if it:
|
2026: /// use std::path::Path;
|
2028: /// assert!(Path::new("/etc/passwd").has_root());
|
2036: /// Returns the `Path` without its final component, if there is one.
|
2038: /// Returns [`None`] if the path terminates in a root or prefix.
|
2043: /// use std::path::Path;
|
2045: /// let path = Path::new("/foo/bar");
|
2046: /// let parent = path.parent().unwrap();
|
2047: /// assert_eq!(parent, Path::new("/foo"));
|
2050: /// assert_eq!(grand_parent, Path::new("/"));
|
2054: pub fn parent(&self) -> Option<&Path> {
|
2059: Some(comps.as_path())
|
2065: /// Produces an iterator over `Path` and its ancestors.
|
2067: /// The iterator will yield the `Path` that is returned if the [`parent`] method is used zero
|
2076: /// use std::path::Path;
|
2078: /// let mut ancestors = Path::new("/foo/bar").ancestors();
|
2079: /// assert_eq!(ancestors.next(), Some(Path::new("/foo/bar")));
|
2080: /// assert_eq!(ancestors.next(), Some(Path::new("/foo")));
|
2081: /// assert_eq!(ancestors.next(), Some(Path::new("/")));
|
2084: /// let mut ancestors = Path::new("../foo/bar").ancestors();
|
2085: /// assert_eq!(ancestors.next(), Some(Path::new("../foo/bar")));
|
2086: /// assert_eq!(ancestors.next(), Some(Path::new("../foo")));
|
2087: /// assert_eq!(ancestors.next(), Some(Path::new("..")));
|
2088: /// assert_eq!(ancestors.next(), Some(Path::new("")));
|
2092: /// [`parent`]: Path::parent
|
2098: /// Returns the final component of the `Path`, if there is one.
|
2100: /// If the path is a normal file, this is the file name. If it's the path of a directory, this
|
2103: /// Returns [`None`] if the path terminates in `..`.
|
2108: /// use std::path::Path;
|
2111: /// assert_eq!(Some(OsStr::new("bin")), Path::new("/usr/bin/").file_name());
|
2112: /// assert_eq!(Some(OsStr::new("foo.txt")), Path::new("tmp/foo.txt").file_name());
|
2113: /// assert_eq!(Some(OsStr::new("foo.txt")), Path::new("foo.txt/.").file_name());
|
2114: /// assert_eq!(Some(OsStr::new("foo.txt")), Path::new("foo.txt/.//").file_name());
|
2115: /// assert_eq!(None, Path::new("foo.txt/..").file_name());
|
2116: /// assert_eq!(None, Path::new("/").file_name());
|
2126: /// Returns a path that, when joined onto `base`, yields `self`.
|
2133: /// [`starts_with`]: Path::starts_with
|
2138: /// use std::path::{Path, PathBuf};
|
2140: /// let path = Path::new("/test/haha/foo.txt");
|
2142: /// assert_eq!(path.strip_prefix("/"), Ok(Path::new("test/haha/foo.txt")));
|
2143: /// assert_eq!(path.strip_prefix("/test"), Ok(Path::new("haha/foo.txt")));
|
2144: /// assert_eq!(path.strip_prefix("/test/"), Ok(Path::new("haha/foo.txt")));
|
2145: /// assert_eq!(path.strip_prefix("/test/haha/foo.txt"), Ok(Path::new("")));
|
2146: /// assert_eq!(path.strip_prefix("/test/haha/foo.txt/"), Ok(Path::new("")));
|
2148: /// assert!(path.strip_prefix("test").is_err());
|
2149: /// assert!(path.strip_prefix("/haha").is_err());
|
2152: /// assert_eq!(path.strip_prefix(prefix), Ok(Path::new("haha/foo.txt")));
|
2154: pub fn strip_prefix<P>(&self, base: P) -> Result<&Path, StripPrefixError>
|
2156: P: AsRef<Path>,
|
2161: fn _strip_prefix(&self, base: &Path) -> Result<&Path, StripPrefixError> {
|
2163: .map(|c| c.as_path())
|
2169: /// Only considers whole path components to match.
|
2174: /// use std::path::Path;
|
2176: /// let path = Path::new("/etc/passwd");
|
2178: /// assert!(path.starts_with("/etc"));
|
2179: /// assert!(path.starts_with("/etc/"));
|
2180: /// assert!(path.starts_with("/etc/passwd"));
|
2181: /// assert!(path.starts_with("/etc/passwd/")); // extra slash is okay
|
2182: /// assert!(path.starts_with("/etc/passwd///")); // multiple extra slashes are okay
|
2184: /// assert!(!path.starts_with("/e"));
|
2185: /// assert!(!path.starts_with("/etc/passwd.txt"));
|
2187: /// assert!(!Path::new("/etc/foo.rs").starts_with("/etc/foo"));
|
2190: pub fn starts_with<P: AsRef<Path>>(&self, base: P) -> bool {
|
2194: fn _starts_with(&self, base: &Path) -> bool {
|
2200: /// Only considers whole path components to match.
|
2205: /// use std::path::Path;
|
2207: /// let path = Path::new("/etc/resolv.conf");
|
2209: /// assert!(path.ends_with("resolv.conf"));
|
2210: /// assert!(path.ends_with("etc/resolv.conf"));
|
2211: /// assert!(path.ends_with("/etc/resolv.conf"));
|
2213: /// assert!(!path.ends_with("/resolv.conf"));
|
2214: /// assert!(!path.ends_with("conf")); // use .extension() instead
|
2217: pub fn ends_with<P: AsRef<Path>>(&self, child: P) -> bool {
|
2221: fn _ends_with(&self, child: &Path) -> bool {
|
2227: /// [`self.file_name`]: Path::file_name
|
2239: /// use std::path::Path;
|
2241: /// assert_eq!("foo", Path::new("foo.rs").file_stem().unwrap());
|
2242: /// assert_eq!("foo.tar", Path::new("foo.tar.gz").file_stem().unwrap());
|
2246: /// This method is similar to [`Path::file_prefix`], which extracts the portion of the file name
|
2249: /// [`Path::file_prefix`]: Path::file_prefix
|
2266: /// [`self.file_name`]: Path::file_name
|
2271: /// # #![feature(path_file_prefix)]
|
2272: /// use std::path::Path;
|
2274: /// assert_eq!("foo", Path::new("foo.rs").file_prefix().unwrap());
|
2275: /// assert_eq!("foo", Path::new("foo.tar.gz").file_prefix().unwrap());
|
2279: /// This method is similar to [`Path::file_stem`], which extracts the portion of the file name
|
2282: /// [`Path::file_stem`]: Path::file_stem
|
2298: /// [`self.file_name`]: Path::file_name
|
2303: /// use std::path::Path;
|
2305: /// assert_eq!("rs", Path::new("foo.rs").extension().unwrap());
|
2306: /// assert_eq!("gz", Path::new("foo.tar.gz").extension().unwrap());
|
2313: /// Creates an owned [`PathBuf`] with `path` adjoined to `self`.
|
2315: /// See [`PathBuf::push`] for more details on what it means to adjoin a path.
|
2320: /// use std::path::{Path, PathBuf};
|
2322: /// assert_eq!(Path::new("/etc").join("passwd"), PathBuf::from("/etc/passwd"));
|
2325: pub fn join<P: AsRef<Path>>(&self, path: P) -> PathBuf {
|
2326: self._join(path.as_ref())
|
2329: fn _join(&self, path: &Path) -> PathBuf {
|
2330: let mut buf = self.to_path_buf();
|
2331: buf.push(path);
|
2342: /// use std::path::{Path, PathBuf};
|
2344: /// let path = Path::new("/tmp/foo.txt");
|
2345: /// assert_eq!(path.with_file_name("bar.txt"), PathBuf::from("/tmp/bar.txt"));
|
2347: /// let path = Path::new("/tmp");
|
2348: /// assert_eq!(path.with_file_name("var"), PathBuf::from("/var"));
|
2356: let mut buf = self.to_path_buf();
|
2368: /// use std::path::{Path, PathBuf};
|
2370: /// let path = Path::new("foo.rs");
|
2371: /// assert_eq!(path.with_extension("txt"), PathBuf::from("foo.txt"));
|
2373: /// let path = Path::new("foo.tar.gz");
|
2374: /// assert_eq!(path.with_extension(""), PathBuf::from("foo.tar"));
|
2375: /// assert_eq!(path.with_extension("xz"), PathBuf::from("foo.tar.xz"));
|
2376: /// assert_eq!(path.with_extension("").with_extension("txt"), PathBuf::from("foo.txt"));
|
2383: let mut buf = self.to_path_buf();
|
2388: /// Produces an iterator over the [`Component`]s of the path.
|
2390: /// When parsing the path, there is a small amount of normalization:
|
2396: /// beginning of the path. For example, `a/./b`, `a/b/`, `a/b/.` and
|
2409: /// use std::path::{Path, Component};
|
2412: /// let mut components = Path::new("/tmp/foo.txt").components();
|
2424: path: self.as_u8_slice(),
|
2432: /// Produces an iterator over the path's components viewed as [`OsStr`]
|
2435: /// For more information about the particulars of how the path is separated
|
2438: /// [`components`]: Path::components
|
2443: /// use std::path::{self, Path};
|
2446: /// let mut it = Path::new("/tmp/foo.txt").iter();
|
2447: /// assert_eq!(it.next(), Some(OsStr::new(&path::MAIN_SEPARATOR.to_string())));
|
2460: /// escapes the path please use [`Debug`] instead.
|
2467: /// use std::path::Path;
|
2469: /// let path = Path::new("/tmp/foo.rs");
|
2471: /// println!("{}", path.display());
|
2473: #[must_use = "this does not display the path, \
|
2477: Display { path: self }
|
2490: /// use std::path::Path;
|
2492: /// let path = Path::new("/Minas/tirith");
|
2493: /// let metadata = path.metadata().expect("metadata call failed");
|
2509: /// use std::path::Path;
|
2511: /// let path = Path::new("/Minas/tirith");
|
2512: /// let metadata = path.symlink_metadata().expect("symlink_metadata call failed");
|
2521: /// Returns the canonical, absolute form of the path with all intermediate
|
2529: /// use std::path::{Path, PathBuf};
|
2531: /// let path = Path::new("/foo/test/../test/bar.rs");
|
2532: /// assert_eq!(path.canonicalize().unwrap(), PathBuf::from("/foo/test/bar.rs"));
|
2547: /// use std::path::Path;
|
2549: /// let path = Path::new("/laputa/sky_castle.rs");
|
2550: /// let path_link = path.read_link().expect("read_link call failed");
|
2568: /// use std::path::Path;
|
2570: /// let path = Path::new("/laputa");
|
2571: /// for entry in path.read_dir().expect("read_dir call failed") {
|
2573: /// println!("{:?}", entry.path());
|
2583: /// Returns `true` if the path points at an existing entity.
|
2594: /// use std::path::Path;
|
2595: /// assert!(!Path::new("does_not_exist.txt").exists());
|
2609: /// Returns `Ok(true)` if the path points at an existing entity.
|
2615: /// unrelated to the path not existing. (E.g. it will return `Err(_)` in case of permission
|
2621: /// #![feature(path_try_exists)]
|
2623: /// use std::path::Path;
|
2624: /// assert!(!Path::new("does_not_exist.txt").try_exists().expect("Can't check existence of file does_not_exist.txt"))...(1 bytes skipped)...
|
2625: /// assert!(Path::new("/root/secret_file.txt").try_exists().is_err());
|
2637: /// Returns `true` if the path exists on disk and is pointing at a regular file.
|
2648: /// use std::path::Path;
|
2649: /// assert_eq!(Path::new("./is_a_directory/").is_file(), false);
|
2650: /// assert_eq!(Path::new("a_file.txt").is_file(), true);
|
2670: /// Returns `true` if the path exists on disk and is pointing at a directory.
|
2681: /// use std::path::Path;
|
2682: /// assert_eq!(Path::new("./is_a_directory/").is_dir(), true);
|
2683: /// assert_eq!(Path::new("a_file.txt").is_dir(), false);
|
2697: /// Returns `true` if the path exists on disk and is pointing at a symbolic link.
|
2709: /// use std::path::Path;
|
2712: /// let link_path = Path::new("link");
|
2713: /// symlink("/origin_does_not_exist/", link_path).unwrap();
|
2714: /// assert_eq!(link_path.is_symlink(), true);
|
2715: /// assert_eq!(link_path.exists(), false);
|
2729: /// Converts a [`Box<Path>`](Box) into a [`PathBuf`] without copying or
|
2754: /// A [`Path`] might contain non-Unicode data. This `struct` implements the
|
2756: /// [`display`](Path::display) method on [`Path`]. This may perform lossy
|
2758: /// which escapes the path please use [`Debug`] instead.
|
2763: /// use std::path::Path;
|
2765: /// let path = Path::new("/tmp/foo.rs");
|
2767: /// println!("{}", path.display());
|
2778: fmt::Debug::fmt(&self.path, f)
|
2784: self.path.inner.display(f)
|
2790: fn eq(&self, other: &Path) -> bool {
|
2849: fn partial_cmp(&self, other: &Path) -> Option<cmp::Ordering> {
|
2856: fn cmp(&self, other: &Path) -> cmp::Ordering {
|
2863: fn as_ref(&self) -> &Path {
|
2868: impl AsRef<Path> for OsStr {
|
2870: fn as_ref(&self) -> &Path {
|
2871: Path::new(self)
|
2875: impl AsRef<Path> for Cow<'_, OsStr> {
|
2877: fn as_ref(&self) -> &Path {
|
2878: Path::new(self)
|
2882: impl AsRef<Path> for OsString {
|
2884: fn as_ref(&self) -> &Path {
|
2885: Path::new(self)
|
2889: impl AsRef<Path> for str {
|
2891: fn as_ref(&self) -> &Path {
|
2892: Path::new(self)
|
2896: impl AsRef<Path> for String {
|
2898: fn as_ref(&self) -> &Path {
|
2899: Path::new(self)
|
2905: fn as_ref(&self) -> &Path {
|
2933: <Path as PartialEq>::eq(self, other)
|
2940: <Path as PartialEq>::eq(self, other)
|
2947: <Path as PartialOrd>::partial_cmp(self, other)
|
2954: <Path as PartialOrd>::partial_cmp(self, other)
|
2960: impl_cmp!(PathBuf, Path);
|
2961: impl_cmp!(PathBuf, &'a Path);
|
2962: impl_cmp!(Cow<'a, Path>, Path);
|
2963: impl_cmp!(Cow<'a, Path>, &'b Path);
|
2964: impl_cmp!(Cow<'a, Path>, PathBuf);
|
2971: <Path as PartialEq>::eq(self, other.as_ref())
|
2978: <Path as PartialEq>::eq(self.as_ref(), other)
|
2985: <Path as PartialOrd>::partial_cmp(self, other.as_ref())
|
2992: <Path as PartialOrd>::partial_cmp(self.as_ref(), other)
|
3002: impl_cmp_os_str!(Path, OsStr);
|
3003: impl_cmp_os_str!(Path, &'a OsStr);
|
3004: impl_cmp_os_str!(Path, Cow<'a, OsStr>);
|
3005: impl_cmp_os_str!(Path, OsString);
|
3006: impl_cmp_os_str!(&'a Path, OsStr);
|
3007: impl_cmp_os_str!(&'a Path, Cow<'b, OsStr>);
|
3008: impl_cmp_os_str!(&'a Path, OsString);
|
3009: impl_cmp_os_str!(Cow<'a, Path>, OsStr);
|
3010: impl_cmp_os_str!(Cow<'a, Path>, &'b OsStr);
|
3011: impl_cmp_os_str!(Cow<'a, Path>, OsString);
|
3027: /// Makes the path absolute without accessing the filesystem.
|
3029: /// If the path is relative, the current directory is used as the base directory.
|
3032: /// resolve symlinks and may succeed even if the path does not exist.
|
3034: /// If the `path` is empty or getting the
|
3043: /// #![feature(absolute_path)]
|
3046: /// use std::path::{self, Path};
|
3049: /// let absolute = path::absolute("foo/./bar")?;
|
3053: /// let absolute = path::absolute("/foo//test/.././bar.rs")?;
|
3054: /// assert_eq!(absolute, Path::new("/foo/test/../bar.rs"));
|
3061: /// The path is resolved using [POSIX semantics][posix-semantics] except that
|
3068: /// #![feature(absolute_path)]
|
3071: /// use std::path::{self, Path};
|
3074: /// let absolute = path::absolute("foo/./bar")?;
|
3078: /// let absolute = path::absolute(r"C:\foo//test\..\./bar.rs")?;
|
3080: /// assert_eq!(absolute, Path::new(r"C:\foo\bar.rs"));
|
3087: /// For verbatim paths this will simply return the path as given. For other
|
3088: /// paths this is currently equivalent to calling [`GetFullPathNameW`][windows-path]
|
3092: /// [windows-path]: https://docs.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-getfullpathnamew
|
3094: pub fn absolute<P: AsRef<Path>>(path: P) -> io::Result<PathBuf> {
|
3095: _absolute(path)
|
3098: pub(crate) fn _absolute<P: AsRef<Path>>(path: P) -> io::Result<PathBuf> {
|
3099: let path = path.as_ref();
|
3100: if path.as_os_str().is_empty() {
|
3101: Err(io::const_io_error!(io::ErrorKind::InvalidInput, "cannot make an empty path absolute",))
|
3103: sys::path::absolute(path)
|
21: //! and [`str`]), for working with paths abstractly. These types are thin wrappers
|
25: //! Paths can be parsed into [`Component`]s by iterating over the structure
|
29: //! [`PathBuf`]; note that the paths may differ syntactically by the
|
42: //! new owned paths.
|
63: //! To build or modify paths, use [`PathBuf`]:
|
82: //! [`push`]: PathBuf::push
|
974: // compare back to front since absolute paths often share long prefixes
|
1074: /// [`push`]: PathBuf::push
|
1075: /// [`set_extension`]: PathBuf::set_extension
|
1082: /// You can use [`push`] to build up a `PathBuf` from
|
1116: #[cfg_attr(not(test), rustc_diagnostic_item = "PathBuf")]
|
1118: // `PathBuf::as_mut_vec` current implementation relies
|
1119: // on `PathBuf` being layout-compatible with `Vec<u8>`.
|
1120: // When attribute privacy is implemented, `PathBuf` should be annotated as `#[repr(transparent)]`.
|
1121: // Anyway, `PathBuf` representation and layout are considered implementation detail, are
|
1130: unsafe { &mut *(self as *mut PathBuf as *mut Vec<u8>) }
|
1133: /// Allocates an empty `PathBuf`.
|
1144: pub fn new() -> PathBuf {
|
1145: PathBuf { inner: OsString::new() }
|
1148: /// Creates a new `PathBuf` with a given capacity used to create the
|
1168: pub fn with_capacity(capacity: usize) -> PathBuf {
|
1169: PathBuf { inner: OsString::with_capacity(capacity) }
|
1179: /// let p = PathBuf::from("/test");
|
1245: // verbatim paths need . and .. removed
|
1310: /// let mut p = PathBuf::from("/spirited/away.rs");
|
1337: /// [`pop`]: PathBuf::pop
|
1344: /// let mut buf = PathBuf::from("/");
|
1347: /// assert!(buf == PathBuf::from("/bar"));
|
1350: /// assert!(buf == PathBuf::from("/baz.txt"));
|
1380: /// let mut p = PathBuf::from("/feel/the");
|
1415: /// Consumes the `PathBuf`, yielding its internal [`OsString`] storage.
|
1422: /// let p = PathBuf::from("/the/head");
|
1509: PathBuf { inner: self.inner.clone() }
|
1571: /// Converts a borrowed [`OsStr`] to a [`PathBuf`].
|
1573: /// Allocates a [`PathBuf`] and copies the data into it.
|
1575: fn from(s: &T) -> PathBuf {
|
1576: PathBuf::from(s.as_ref().to_os_string())
|
1581: /// Converts an [`OsString`] into a [`PathBuf`]
|
1585: fn from(s: OsString) -> PathBuf {
|
1586: PathBuf { inner: s }
|
1590: impl From<PathBuf> for OsString {
|
1591: /// Converts a [`PathBuf`] into an [`OsString`]
|
1601: /// Converts a [`String`] into a [`PathBuf`]
|
1605: fn from(s: String) -> PathBuf {
|
1606: PathBuf::from(OsString::from(s))
|
1615: Ok(PathBuf::from(s))
|
1620: fn from_iter<I: IntoIterator<Item = P>>(iter: I) -> PathBuf {
|
1621: let mut buf = PathBuf::new();
|
1662: PathBuf::new()
|
1679: /// instance of [`PathBuf`].
|
1690: /// [`PathBuf`].
|
1748: type Owned = PathBuf;
|
1750: fn to_owned(&self) -> PathBuf {
|
1754: fn clone_into(&self, target: &mut PathBuf) {
|
1761: fn eq(&self, other: &PathBuf) -> bool {
|
1776: fn partial_cmp(&self, other: &PathBuf) -> Option<cmp::Ordering> {
|
1783: fn cmp(&self, other: &PathBuf) -> cmp::Ordering {
|
1804: /// see [`PathBuf`].
|
1964: PathBuf::from(self.inner.to_os_string())
|
2151: /// let prefix = PathBuf::from("/test/");
|
2335: /// Creates an owned [`PathBuf`] like `self` but with the given file name.
|
2337: /// See [`PathBuf::set_file_name`] for more details.
|
2351: pub fn with_file_name<S: AsRef<OsStr>>(&self, file_name: S) -> PathBuf {
|
2355: fn _with_file_name(&self, file_name: &OsStr) -> PathBuf {
|
2361: /// Creates an owned [`PathBuf`] like `self` but with the given extension.
|
2363: /// See [`PathBuf::set_extension`] for more details.
|
2378: pub fn with_extension<S: AsRef<OsStr>>(&self, extension: S) -> PathBuf {
|
2382: fn _with_extension(&self, extension: &OsStr) -> PathBuf {
|
2457: /// Returns an object that implements [`Display`] for safely printing paths
|
2536: pub fn canonicalize(&self) -> io::Result<PathBuf> {
|
2554: pub fn read_link(&self) -> io::Result<PathBuf> {
|
2735: PathBuf { inner: OsString::from(inner) }
|
2752: /// Helper struct for safely printing paths with [`format!`] and `{}`.
|
2998: impl_cmp_os_str!(PathBuf, OsStr);
|
2999: impl_cmp_os_str!(PathBuf, &'a OsStr);
|
3000: impl_cmp_os_str!(PathBuf, Cow<'a, OsStr>);
|
3001: impl_cmp_os_str!(PathBuf, OsString);
|
3040: /// ## Posix paths
|
3065: /// ## Windows paths
|
github.com/apache/servicecomb-service-center:datasource/etcd/path/key_generator.go: [ master, ] |
---|
18: package path
|
github.com/apache/incubator-teaclave:third_party/rust-sgx-sdk/sgx_tstd/src/path.rs: [ master, ] |
---|
392: path: &'a [u8],
|
1202: impl ToOwned for Path {
|
1262: pub struct Path {
|
1277: impl Path {
|
1730: impl AsRef<OsStr> for Path {
|
1736: impl fmt::Debug for Path {
|
1749: path: &'a Path,
|
1764: impl cmp::PartialEq for Path {
|
1770: impl Hash for Path {
|
1778: impl cmp::Eq for Path {}
|
1780: impl cmp::PartialOrd for Path {
|
1786: impl cmp::Ord for Path {
|
1792: impl AsRef<Path> for Path {
|
1844: impl<'a> IntoIterator for &'a Path {
|
475: pub fn as_path(&self) -> &'a Path {
|
602: pub fn as_path(&self) -> &'a Path {
|
823: pub fn as_path(&self) -> &Path {
|
968: pub fn into_boxed_path(self) -> Box<Path> {
|
797: pub struct PathBuf {
|
801: impl PathBuf {
|
1030: impl From<Box<Path>> for PathBuf {
|
1056: impl<T: ?Sized + AsRef<OsStr>> From<&T> for PathBuf {
|
1062: impl From<OsString> for PathBuf {
|
1081: impl From<String> for PathBuf {
|
1090: impl FromStr for PathBuf {
|
1098: impl<P: AsRef<Path>> iter::FromIterator<P> for PathBuf {
|
1106: impl<P: AsRef<Path>> iter::Extend<P> for PathBuf {
|
1112: impl fmt::Debug for PathBuf {
|
1118: impl ops::Deref for PathBuf {
|
1126: impl Borrow<Path> for PathBuf {
|
1132: impl Default for PathBuf {
|
1159: impl<'a> From<Cow<'a, Path>> for PathBuf {
|
1212: impl cmp::PartialEq for PathBuf {
|
1218: impl Hash for PathBuf {
|
1224: impl cmp::Eq for PathBuf {}
|
1226: impl cmp::PartialOrd for PathBuf {
|
1232: impl cmp::Ord for PathBuf {
|
1238: impl AsRef<OsStr> for PathBuf {
|
1829: impl AsRef<Path> for PathBuf {
|
1836: impl<'a> IntoIterator for &'a PathBuf {
|
1333: pub fn to_path_buf(&self) -> PathBuf {
|
1723: pub fn into_path_buf(self: Box<Path>) -> PathBuf {
|
18: //! Cross-platform path manipulation.
|
20: //! This module provides two types, [`PathBuf`] and [`Path`] (akin to [`String`]
|
23: //! on strings according to the local platform's path syntax.
|
26: //! returned by the [`components`] method on [`Path`]. [`Component`]s roughly
|
27: //! correspond to the substrings between path separators (`/` or `\`). You can
|
28: //! reconstruct an equivalent path from components with the [`push`] method on
|
39: use crate::sys::path::{is_sep_byte, is_verbatim_sep, parse_prefix, MAIN_SEP_STR};
|
65: /// Windows path prefixes, e.g., `C:` or `\\server\share`.
|
67: /// Windows uses a variety of path prefix styles, including references to drive
|
69: /// others. In addition, some path prefixes are "verbatim" (i.e., prefixed with
|
152: /// Determines whether the character is one of the permitted path
|
159: /// The primary separator of path components for the current platform.
|
162: pub const MAIN_SEPARATOR: char = crate::sys::path::MAIN_SEP;
|
210: let path = if let Some(p) = prefix { &s[p.len()..] } else { s };
|
211: !path.is_empty() && is_sep_byte(path[0])
|
242: /// front and back of the path each keep track of what parts of the path have
|
245: /// Going front to back, a path is made up of a prefix, a starting
|
255: /// A structure wrapping a Windows path prefix as well as its unparsed string
|
319: /// A single component of a path.
|
321: /// A `Component` roughly corresponds to a substring between path separators
|
325: /// created by the [`components`][`Path::components`] method on [`Path`].
|
330: /// A Windows path prefix, e.g., `C:` or `\\server\share`.
|
342: /// It represents a separator that designates that a path starts from root.
|
367: Component::Normal(path) => path,
|
378: impl AsRef<Path> for Component<'_> {
|
379: fn as_ref(&self) -> &Path {
|
384: /// An iterator over the [`Component`]s of a [`Path`].
|
386: /// This `struct` is created by the [`components`] method on [`Path`].
|
391: // The path left to parse components from
|
397: // true if path *physically* has a root separator; for most Windows
|
408: /// An iterator over the [`Component`]s of a [`Path`], as [`OsStr`] slices.
|
410: /// This `struct` is created by the [`iter`] method on [`Path`].
|
414: /// [`iter`]: struct.Path.html#method.iter
|
416: /// [`Path`]: struct.Path.html
|
424: struct DebugHelper<'a>(&'a Path);
|
432: f.debug_tuple("Components").field(&DebugHelper(self.as_path())).finish()
|
454: // Given the iteration so far, how much of the pre-State::Body path is left?
|
473: /// Extracts a slice corresponding to the portion of the path remaining for iteration.
|
483: unsafe { Path::from_u8_slice(comps.path) }
|
486: /// Is the *original* path rooted?
|
499: /// Should the normalized path include a leading . ?
|
504: let mut iter = self.path[self.prefix_len()..].iter();
|
512: // parse a given byte sequence into the corresponding path component
|
517: // the beginning of a path, which is treated
|
529: let (extra, comp) = match self.path.iter().position(|b| self.is_sep_byte(*b)) {
|
530: None => (0, self.path),
|
531: Some(i) => (1, &self.path[..i]),
|
541: let (extra, comp) = match self.path[start..].iter().rposition(|b| self.is_sep_byte(*b)) {
|
542: None => (0, &self.path[start..]),
|
543: Some(i) => (1, &self.path[start + i + 1..]),
|
550: while !self.path.is_empty() {
|
555: self.path = &self.path[size..];
|
562: while self.path.len() > self.len_before_body() {
|
567: self.path = &self.path[..self.path.len() - size];
|
573: impl AsRef<Path> for Components<'_> {
|
574: fn as_ref(&self) -> &Path {
|
575: self.as_path()
|
581: self.as_path().as_os_str()
|
587: struct DebugHelper<'a>(&'a Path);
|
595: f.debug_tuple("Iter").field(&DebugHelper(self.as_path())).finish()
|
600: /// Extracts a slice corresponding to the portion of the path remaining for iteration.
|
603: self.inner.as_path()
|
607: impl AsRef<Path> for Iter<'_> {
|
608: fn as_ref(&self) -> &Path {
|
609: self.as_path()
|
615: self.as_path().as_os_str()
|
643: debug_assert!(self.prefix_len() <= self.path.len());
|
644: let raw = &self.path[..self.prefix_len()];
|
645: self.path = &self.path[self.prefix_len()..];
|
657: debug_assert!(!self.path.is_empty());
|
658: self.path = &self.path[1..];
|
665: debug_assert!(!self.path.is_empty());
|
666: self.path = &self.path[1..];
|
670: State::Body if !self.path.is_empty() => {
|
672: self.path = &self.path[size..];
|
691: State::Body if self.path.len() > self.len_before_body() => {
|
693: self.path = &self.path[..self.path.len() - size];
|
704: self.path = &self.path[..self.path.len() - 1];
|
711: self.path = &self.path[..self.path.len() - 1];
|
718: raw: unsafe { u8_slice_as_os_str(self.path) },
|
755: /// An iterator over [`Path`] and its ancestors.
|
757: /// This `struct` is created by the [`ancestors`] method on [`Path`].
|
762: next: Option<&'a Path>,
|
766: type Item = &'a Path;
|
770: self.next = next.and_then(Path::parent);
|
781: /// An owned, mutable path (akin to [`String`]).
|
784: /// the path in place. It also implements [`Deref`] to [`Path`], meaning that
|
785: /// all methods on [`Path`] slices are available on `PathBuf` values as well.
|
788: /// [`Path`]: struct.Path.html
|
819: /// Coerces to a [`Path`] slice.
|
821: /// [`Path`]: struct.Path.html
|
827: /// Extends `self` with `path`.
|
829: /// If `path` is absolute, it replaces the current path.
|
833: /// * if `path` has a root but no prefix (e.g., `\windows`), it
|
835: /// * if `path` has a prefix but no root, it replaces `self`.
|
837: pub fn push<P: AsRef<Path>>(&mut self, path: P) {
|
838: self._push(path.as_ref())
|
841: fn _push(&mut self, path: &Path) {
|
849: && comps.prefix_len() == comps.path.len()
|
856: // absolute `path` replaces `self`
|
857: if path.is_absolute() || path.prefix().is_some() {
|
860: // `path` has a root but no prefix, e.g., `\windows` (Windows only)
|
861: } else if path.has_root() {
|
865: // `path` is a pure relative path
|
870: self.inner.push(path);
|
898: /// `file_name`. The new path will be a sibling of the original path.
|
964: /// Converts this `PathBuf` into a [boxed][`Box`] [`Path`].
|
967: /// [`Path`]: struct.Path.html
|
969: let rw = Box::into_raw(self.inner.into_boxed_os_str()) as *mut Path;
|
1022: impl From<&Path> for Box<Path> {
|
1023: fn from(path: &Path) -> Box<Path> {
|
1024: let boxed: Box<OsStr> = path.inner.into();
|
1025: let rw = Box::into_raw(boxed) as *mut Path;
|
1031: /// Converts a `Box<Path>` into a `PathBuf`
|
1034: fn from(boxed: Box<Path>) -> PathBuf {
|
1035: boxed.into_path_buf()
|
1039: impl From<PathBuf> for Box<Path> {
|
1040: /// Converts a `PathBuf` into a `Box<Path>`
|
1044: fn from(p: PathBuf) -> Box<Path> {
|
1045: p.into_boxed_path()
|
1049: impl Clone for Box<Path> {
|
1052: self.to_path_buf().into_boxed_path()
|
1076: fn from(path_buf: PathBuf) -> OsString {
|
1077: path_buf.inner
|
1119: type Target = Path;
|
1121: fn deref(&self) -> &Path {
|
1122: Path::new(&self.inner)
|
1127: fn borrow(&self) -> &Path {
|
1138: impl<'a> From<&'a Path> for Cow<'a, Path> {
|
1140: fn from(s: &'a Path) -> Cow<'a, Path> {
|
1145: impl<'a> From<PathBuf> for Cow<'a, Path> {
|
1147: fn from(s: PathBuf) -> Cow<'a, Path> {
|
1152: impl<'a> From<&'a PathBuf> for Cow<'a, Path> {
|
1154: fn from(p: &'a PathBuf) -> Cow<'a, Path> {
|
1155: Cow::Borrowed(p.as_path())
|
1161: fn from(p: Cow<'a, Path>) -> Self {
|
1166: impl From<PathBuf> for Arc<Path> {
|
1169: fn from(s: PathBuf) -> Arc<Path> {
|
1171: unsafe { Arc::from_raw(Arc::into_raw(arc) as *const Path) }
|
1175: impl From<&Path> for Arc<Path> {
|
1176: /// Converts a `Path` into an `Arc` by copying the `Path` data into a new `Arc` buffer.
|
1178: fn from(s: &Path) -> Arc<Path> {
|
1180: unsafe { Arc::from_raw(Arc::into_raw(arc) as *const Path) }
|
1184: impl From<PathBuf> for Rc<Path> {
|
1187: fn from(s: PathBuf) -> Rc<Path> {
|
1189: unsafe { Rc::from_raw(Rc::into_raw(rc) as *const Path) }
|
1193: impl From<&Path> for Rc<Path> {
|
1194: /// Converts a `Path` into an `Rc` by copying the `Path` data into a new `Rc` buffer.
|
1196: fn from(s: &Path) -> Rc<Path> {
|
1198: unsafe { Rc::from_raw(Rc::into_raw(rc) as *const Path) }
|
1205: self.to_path_buf()
|
1220: self.as_path().hash(h)
|
1244: /// A slice of a path (akin to [`str`]).
|
1246: /// This type supports a number of operations for inspecting a path, including
|
1247: /// breaking the path into its components (separated by `/` on Unix and by either
|
1248: /// `/` or `\` on Windows), extracting the file name, determining whether the path
|
1266: /// An error returned from [`Path::strip_prefix`][`strip_prefix`] if the prefix
|
1269: /// This `struct` is created by the [`strip_prefix`] method on [`Path`].
|
1272: /// [`strip_prefix`]: struct.Path.html#method.strip_prefix
|
1273: /// [`Path`]: struct.Path.html
|
1278: // The following (private!) function allows construction of a path from a u8
|
1280: unsafe fn from_u8_slice(s: &[u8]) -> &Path {
|
1281: Path::new(u8_slice_as_os_str(s))
|
1288: /// Directly wraps a string slice as a `Path` slice.
|
1292: pub fn new<S: AsRef<OsStr> + ?Sized>(s: &S) -> &Path {
|
1293: unsafe { &*(s.as_ref() as *const OsStr as *const Path) }
|
1304: /// Yields a [`&str`] slice if the `Path` is valid unicode.
|
1316: /// Converts a `Path` to a [`Cow<str>`].
|
1328: /// Converts a `Path` to an owned [`PathBuf`].
|
1337: /// Returns `true` if the `Path` is absolute, i.e., if it is independent of
|
1340: /// * On Unix, a path is absolute if it starts with the root, so
|
1343: /// * On Windows, a path is absolute if it has a prefix and starts with the
|
1351: /// Returns `true` if the `Path` is relative, i.e., not absolute.
|
1363: /// Returns `true` if the `Path` has a root.
|
1365: /// * On Unix, a path has a root if it begins with `/`.
|
1367: /// * On Windows, a path has a root if it:
|
1376: /// Returns the `Path` without its final component, if there is one.
|
1378: /// Returns [`None`] if the path terminates in a root or prefix.
|
1382: pub fn parent(&self) -> Option<&Path> {
|
1387: Some(comps.as_path())
|
1393: /// Produces an iterator over `Path` and its ancestors.
|
1395: /// The iterator will yield the `Path` that is returned if the [`parent`] method is used zero
|
1405: /// Returns the final component of the `Path`, if there is one.
|
1407: /// If the path is a normal file, this is the file name. If it's the path of a directory, this
|
1410: /// Returns [`None`] if the path terminates in `..`.
|
1421: /// Returns a path that, when joined onto `base`, yields `self`.
|
1431: pub fn strip_prefix<P>(&self, base: P) -> Result<&Path, StripPrefixError>
|
1433: P: AsRef<Path>,
|
1438: fn _strip_prefix(&self, base: &Path) -> Result<&Path, StripPrefixError> {
|
1440: .map(|c| c.as_path())
|
1446: /// Only considers whole path components to match.
|
1448: pub fn starts_with<P: AsRef<Path>>(&self, base: P) -> bool {
|
1452: fn _starts_with(&self, base: &Path) -> bool {
|
1458: /// Only considers whole path components to match.
|
1460: pub fn ends_with<P: AsRef<Path>>(&self, child: P) -> bool {
|
1464: fn _ends_with(&self, child: &Path) -> bool {
|
1470: /// [`self.file_name`]: struct.Path.html#method.file_name
|
1494: /// [`self.file_name`]: struct.Path.html#method.file_name
|
1501: /// Creates an owned [`PathBuf`] with `path` adjoined to `self`.
|
1503: /// See [`PathBuf::push`] for more details on what it means to adjoin a path.
|
1508: pub fn join<P: AsRef<Path>>(&self, path: P) -> PathBuf {
|
1509: self._join(path.as_ref())
|
1512: fn _join(&self, path: &Path) -> PathBuf {
|
1513: let mut buf = self.to_path_buf();
|
1514: buf.push(path);
|
1530: let mut buf = self.to_path_buf();
|
1547: let mut buf = self.to_path_buf();
|
1552: /// Produces an iterator over the [`Component`]s of the path.
|
1554: /// When parsing the path, there is a small amount of normalization:
|
1560: /// beginning of the path. For example, `a/./b`, `a/b/`, `a/b/.` and
|
1573: path: self.as_u8_slice(),
|
1581: /// Produces an iterator over the path's components viewed as [`OsStr`]
|
1584: /// For more information about the particulars of how the path is separated
|
1600: Display { path: self }
|
1628: /// Returns the canonical, absolute form of the path with all intermediate
|
1665: /// use std::path::Path;
|
1667: /// let path = Path::new("/laputa");
|
1668: /// for entry in path.read_dir().expect("read_dir call failed") {
|
1670: /// println!("{:?}", entry.path());
|
1679: /// Returns `true` if the path points at an existing entity.
|
1692: /// Returns `true` if the path exists on disk and is pointing at a regular file.
|
1705: /// Returns `true` if the path exists on disk and is pointing at a directory.
|
1718: /// Converts a [`Box<Path>`][`Box`] into a [`PathBuf`] without copying or
|
1744: /// A [`Path`] might contain non-Unicode data. This `struct` implements the
|
1746: /// [`display`][`Path::display`] method on [`Path`].
|
1754: fmt::Debug::fmt(&self.path, f)
|
1760: self.path.inner.display(f)
|
1765: fn eq(&self, other: &Path) -> bool {
|
1781: fn partial_cmp(&self, other: &Path) -> Option<cmp::Ordering> {
|
1787: fn cmp(&self, other: &Path) -> cmp::Ordering {
|
1793: fn as_ref(&self) -> &Path {
|
1798: impl AsRef<Path> for OsStr {
|
1799: fn as_ref(&self) -> &Path {
|
1800: Path::new(self)
|
1804: impl AsRef<Path> for Cow<'_, OsStr> {
|
1805: fn as_ref(&self) -> &Path {
|
1806: Path::new(self)
|
1810: impl AsRef<Path> for OsString {
|
1811: fn as_ref(&self) -> &Path {
|
1812: Path::new(self)
|
1816: impl AsRef<Path> for str {
|
1818: fn as_ref(&self) -> &Path {
|
1819: Path::new(self)
|
1823: impl AsRef<Path> for String {
|
1824: fn as_ref(&self) -> &Path {
|
1825: Path::new(self)
|
1831: fn as_ref(&self) -> &Path {
|
1857: <Path as PartialEq>::eq(self, other)
|
1864: <Path as PartialEq>::eq(self, other)
|
1871: <Path as PartialOrd>::partial_cmp(self, other)
|
1878: <Path as PartialOrd>::partial_cmp(self, other)
|
1884: impl_cmp!(PathBuf, Path);
|
1885: impl_cmp!(PathBuf, &'a Path);
|
1886: impl_cmp!(Cow<'a, Path>, Path);
|
1887: impl_cmp!(Cow<'a, Path>, &'b Path);
|
1888: impl_cmp!(Cow<'a, Path>, PathBuf);
|
1895: <Path as PartialEq>::eq(self, other.as_ref())
|
1902: <Path as PartialEq>::eq(self.as_ref(), other)
|
1909: <Path as PartialOrd>::partial_cmp(self, other.as_ref())
|
1916: <Path as PartialOrd>::partial_cmp(self.as_ref(), other)
|
1926: impl_cmp_os_str!(Path, OsStr);
|
1927: impl_cmp_os_str!(Path, &'a OsStr);
|
1928: impl_cmp_os_str!(Path, Cow<'a, OsStr>);
|
1929: impl_cmp_os_str!(Path, OsString);
|
1930: impl_cmp_os_str!(&'a Path, OsStr);
|
1931: impl_cmp_os_str!(&'a Path, Cow<'b, OsStr>);
|
1932: impl_cmp_os_str!(&'a Path, OsString);
|
1933: impl_cmp_os_str!(Cow<'a, Path>, OsStr);
|
1934: impl_cmp_os_str!(Cow<'a, Path>, &'b OsStr);
|
1935: impl_cmp_os_str!(Cow<'a, Path>, OsString);
|
21: //! and [`str`]), for working with paths abstractly. These types are thin wrappers
|
25: //! Paths can be parsed into [`Component`]s by iterating over the structure
|
29: //! [`PathBuf`]; note that the paths may differ syntactically by the
|
789: /// [`push`]: struct.PathBuf.html#method.push
|
790: /// [`set_extension`]: struct.PathBuf.html#method.set_extension
|
803: unsafe { &mut *(self as *mut PathBuf as *mut Vec<u8>) }
|
806: /// Allocates an empty `PathBuf`.
|
808: pub fn new() -> PathBuf {
|
809: PathBuf { inner: OsString::new() }
|
812: /// Creates a new `PathBuf` with a given capacity used to create the
|
815: pub fn with_capacity(capacity: usize) -> PathBuf {
|
816: PathBuf { inner: OsString::with_capacity(capacity) }
|
879: /// [`self.parent`]: struct.PathBuf.html#method.parent
|
901: /// [`self.file_name`]: struct.PathBuf.html#method.file_name
|
903: /// [`pop`]: struct.PathBuf.html#method.pop
|
925: /// [`self.file_name`]: struct.PathBuf.html#method.file_name
|
926: /// [`self.extension`]: struct.PathBuf.html#method.extension
|
956: /// Consumes the `PathBuf`, yielding its internal [`OsString`] storage.
|
1057: fn from(s: &T) -> PathBuf {
|
1058: PathBuf::from(s.as_ref().to_os_string())
|
1063: /// Converts a `OsString` into a `PathBuf`
|
1067: fn from(s: OsString) -> PathBuf {
|
1068: PathBuf { inner: s }
|
1072: impl From<PathBuf> for OsString {
|
1073: /// Converts a `PathBuf` into a `OsString`
|
1082: /// Converts a `String` into a `PathBuf`
|
1085: fn from(s: String) -> PathBuf {
|
1086: PathBuf::from(OsString::from(s))
|
1094: Ok(PathBuf::from(s))
|
1099: fn from_iter<I: IntoIterator<Item = P>>(iter: I) -> PathBuf {
|
1100: let mut buf = PathBuf::new();
|
1134: PathBuf::new()
|
1167: /// Converts a `PathBuf` into an `Arc` by moving the `PathBuf` data into a new `Arc` buffer.
|
1185: /// Converts a `PathBuf` into an `Rc` by moving the `PathBuf` data into a new `Rc` buffer.
|
1203: type Owned = PathBuf;
|
1204: fn to_owned(&self) -> PathBuf {
|
1207: fn clone_into(&self, target: &mut PathBuf) {
|
1213: fn eq(&self, other: &PathBuf) -> bool {
|
1227: fn partial_cmp(&self, other: &PathBuf) -> Option<cmp::Ordering> {
|
1233: fn cmp(&self, other: &PathBuf) -> cmp::Ordering {
|
1253: /// see [`PathBuf`].
|
1257: /// [`PathBuf`]: struct.PathBuf.html
|
1330: /// [`PathBuf`]: struct.PathBuf.html
|
1334: PathBuf::from(self.inner.to_os_string())
|
1505: /// [`PathBuf`]: struct.PathBuf.html
|
1506: /// [`PathBuf::push`]: struct.PathBuf.html#method.push
|
1518: /// Creates an owned [`PathBuf`] like `self` but with the given file name.
|
1520: /// See [`PathBuf::set_file_name`] for more details.
|
1522: /// [`PathBuf`]: struct.PathBuf.html
|
1523: /// [`PathBuf::set_file_name`]: struct.PathBuf.html#method.set_file_name
|
1525: pub fn with_file_name<S: AsRef<OsStr>>(&self, file_name: S) -> PathBuf {
|
1529: fn _with_file_name(&self, file_name: &OsStr) -> PathBuf {
|
1535: /// Creates an owned [`PathBuf`] like `self` but with the given extension.
|
1537: /// See [`PathBuf::set_extension`] for more details.
|
1539: /// [`PathBuf`]: struct.PathBuf.html
|
1540: /// [`PathBuf::set_extension`]: struct.PathBuf.html#method.set_extension
|
1542: pub fn with_extension<S: AsRef<OsStr>>(&self, extension: S) -> PathBuf {
|
1546: fn _with_extension(&self, extension: &OsStr) -> PathBuf {
|
1594: /// Returns an object that implements [`Display`] for safely printing paths
|
1636: pub fn canonicalize(&self) -> io::Result<PathBuf> {
|
1647: pub fn read_link(&self) -> io::Result<PathBuf> {
|
1722: /// [`PathBuf`]: struct.PathBuf.html
|
1726: PathBuf { inner: OsString::from(inner) }
|
1742: /// Helper struct for safely printing paths with [`format!`] and `{}`.
|
1922: impl_cmp_os_str!(PathBuf, OsStr);
|
1923: impl_cmp_os_str!(PathBuf, &'a OsStr);
|
1924: impl_cmp_os_str!(PathBuf, Cow<'a, OsStr>);
|
1925: impl_cmp_os_str!(PathBuf, OsString);
|
github.com/apache/flex-sdk:frameworks/projects/spark/src/spark/primitives/Path.as: [ master, ] |
---|
64: public class Path extends FilledElement
|
82: public function Path()
|
1196: class PathSegmentsCollection
|
1214: public function PathSegmentsCollection(value:String)
|
1540: public function generateGraphicsPath(graphicsPath:GraphicsPath,
|
1742: public function PathSegment(_x:Number = 0, _y:Number = 0)
|
39: * The Path class is a filled graphic element that draws a series of path segments.
|
40: * In vector graphics, a path is a series of points connected by straight or curved line segments.
|
41: * Together the lines form an image. In Flex, you use the Path class to define a complex vector shape
|
44: * <p>Typically, the first element of a path definition is a Move segment to specify the starting pen
|
51: * point of the line. You can use multiple Move segments in the path definition to
|
54: * <p>The syntax used by the Path class to define the shape is the same as the SVG path syntax,
|
94: * Dirty flag to indicate when path data has changed.
|
105: * path segment information
|
116: * commands to draw this Path.
|
118: * The data commands expressed in a Path's <code>data</code>
|
140: * A string containing a compact represention of the path segments. This is an alternate
|
144: * <p>The value is a space-delimited string describing each path segment. Each
|
198: * <td>Close path</td>
|
201: * <td>Closes off the path.</td>
|
245: * Fill rule for intersecting or overlapping path segments.
|
322: * Returns the bounding box for the path including stroke, if the path is resized
|
406: * @return Returns the axis aligned bounding box of the path when
|
420: // then the non-stroked path bounds for the give size can be
|
556: // slow code-path Player execution for all graphics in that DisplayObject.
|
708: * if the path is resized to the specified size.
|
947: // Resize transformed path with the iterative solution
|
962: // the path size as the size changes the angles of the joints.
|
1193: * Path segments.
|
1452: * A Vector of the actual path segments. May be empty, but always non-null.
|
1510: // If path is empty, it's untransformed bounding box is (0,0), so we return transformed point (0,0)
|
1522: * array and draws each path egment based on its control points.
|
1524: * Segments are drawn from the x and y position of the path.
|
1526: * applied to the path.
|
1529: * path segment should be drawn
|
1532: * path segment should be drawn
|
1535: * this path segment
|
1538: * path segment
|
1550: // the path will begin at the previous pen location
|
1712: * The PathSegment class is the base class for a segment of a path.
|
1794: * Draws this path segment. You can determine the current pen position by
|
1817: * path segment.
|
24: import flash.display.GraphicsPath;
|
55: * which makes it easy to convert SVG paths to Flex paths.</p>
|
112: private var segments:PathSegmentsCollection;
|
115: * A GraphicsPath object that contains the drawing
|
123: mx_internal var graphicsPath:GraphicsPath = new GraphicsPath(new Vector.<int>(), new Vector.<Number>());
|
218: segments = new PathSegmentsCollection(value);
|
392: private function tangentIsValid(prevSegment:PathSegment, curSegment:PathSegment,
|
418: var pathBBox:Rectangle;
|
424: pathBBox = new Rectangle(naturalBounds.x * sx,
|
429: pathBBox.offset(m.tx, m.ty);
|
433: pathBBox = this.segments.getBoundingBox(width, height, m);
|
439: return pathBBox;
|
441: // Always add half the stroke weight, even for miter limit paths,
|
445: pathBBox.inflate(strokeExtents.right, strokeExtents.bottom);
|
447: var seg:Vector.<PathSegment> = segments.data;
|
453: return pathBBox;
|
473: var prevSegment:PathSegment = start > 0 ? seg[start - 1] : null;
|
482: var startSegment:PathSegment = seg[start];
|
519: var endSegment:PathSegment = seg[end];
|
531: pathBBox);
|
538: return pathBBox;
|
582: private function addMiterLimitStrokeToBounds(segment0:PathSegment,
|
583: segment1:PathSegment,
|
584: segment2:PathSegment,
|
939: // We have special handling for miter-limit stroked non-transformed paths,
|
1098: segments.generateGraphicsPath(graphicsPath, drawX, drawY, sx, sy);
|
1102: g.drawPath(graphicsPath.commands, graphicsPath.data, winding);
|
1187: // Internal Helper Class - PathSegmentsCollection
|
1194: * Provides methods for generating GraphicsPath and calculating bounds.
|
1218: _segments = new Vector.<PathSegment>();
|
1222: var newSegments:Vector.<PathSegment> = new Vector.<PathSegment>();
|
1418: _segments = new Vector.<PathSegment>();
|
1449: private var _segments:Vector.<PathSegment>;
|
1454: public function get data():Vector.<PathSegment>
|
1499: var prevSegment:PathSegment;
|
1500: var pathBBox:Rectangle;
|
1505: var segment:PathSegment = _segments[i];
|
1506: pathBBox = segment.getBoundingBox(prevSegment, sx, sy, m, pathBBox);
|
1511: if (!pathBBox)
|
1515: pathBBox = new Rectangle(x, y);
|
1517: return pathBBox;
|
1546: graphicsPath.commands = null;
|
1547: graphicsPath.data = null;
|
1552: graphicsPath.moveTo(tx, ty);
|
1554: var curSegment:PathSegment;
|
1555: var prevSegment:PathSegment;
|
1561: curSegment.draw(graphicsPath, tx, ty, sx, sy, prevSegment);
|
1702: // Internal Helper Class - PathSegment
|
1705: import flash.display.GraphicsPath;
|
1721: class PathSegment extends Object
|
1805: public function draw(graphicsPath:GraphicsPath, dx:Number,dy:Number,sx:Number,sy:Number,prev:PathSegment):void
|
1824: public function getBoundingBox(prev:PathSegment, sx:Number, sy:Number, m:Matrix, rect:Rectangle):Rectangle
|
1839: public function getTangent(prev:PathSegment, start:Boolean, sx:Number, sy:Number, m:Matrix, result:Point):void
|
1853: import flash.display.GraphicsPath;
|
1869: class LineSegment extends PathSegment
|
1911: override public function draw(graphicsPath:GraphicsPath, dx:Number,dy:Number,sx:Number,sy:Number,prev:PathSegment):void
|
1913: graphicsPath.lineTo(dx + x*sx, dy + y*sy);
|
1924: override public function getBoundingBox(prev:PathSegment, sx:Number, sy:Number, m:Matrix, rect:Rectangle):Rectangle
|
1952: override public function getTangent(prev:PathSegment, start:Boolean, sx:Number, sy:Number, m:Matrix, result:Point):void
|
1967: import flash.display.GraphicsPath;
|
1981: class MoveSegment extends PathSegment
|
2024: override public function draw(graphicsPath:GraphicsPath, dx:Number,dy:Number,sx:Number,sy:Number,prev:PathSegment):void
|
2026: graphicsPath.moveTo(dx+x*sx, dy+y*sy);
|
2036: import flash.display.GraphicsPath;
|
2061: class CubicBezierSegment extends PathSegment
|
2198: override public function draw(graphicsPath:GraphicsPath, dx:Number, dy:Number, sx:Number, sy:Number, prev:PathSegment):void
|
2202: graphicsPath.curveTo(dx + qPts.control1.x*sx, dy+qPts.control1.y*sy, dx+qPts.anchor1.x*sx, dy+qPts.anchor1.y*sy)...(1 bytes skipped)...
|
2203: graphicsPath.curveTo(dx + qPts.control2.x*sx, dy+qPts.control2.y*sy, dx+qPts.anchor2.x*sx, dy+qPts.anchor2.y*sy)...(1 bytes skipped)...
|
2204: graphicsPath.curveTo(dx + qPts.control3.x*sx, dy+qPts.control3.y*sy, dx+qPts.anchor3.x*sx, dy+qPts.anchor3.y*sy)...(1 bytes skipped)...
|
2205: graphicsPath.curveTo(dx + qPts.control4.x*sx, dy+qPts.control4.y*sy, dx+qPts.anchor4.x*sx, dy+qPts.anchor4.y*sy)...(1 bytes skipped)...
|
2216: override public function getBoundingBox(prev:PathSegment, sx:Number, sy:Number,
|
2252: override public function getTangent(prev:PathSegment, start:Boolean, sx:Number, sy:Number, m:Matrix, result:Point):void
|
2318: private function getQuadraticPoints(prev:PathSegment):QuadraticPoints
|
2411: import flash.display.GraphicsPath;
|
2431: class QuadraticBezierSegment extends PathSegment
|
2526: override public function draw(graphicsPath:GraphicsPath, dx:Number,dy:Number,sx:Number,sy:Number,prev:PathSegment):void
|
2528: graphicsPath.curveTo(dx+control1X*sx, dy+control1Y*sy, dx+x*sx, dy+y*sy);
|
2574: override public function getTangent(prev:PathSegment, start:Boolean, sx:Number, sy:Number, m:Matrix, result:Point):void
|
2591: override public function getBoundingBox(prev:PathSegment, sx:Number, sy:Number,
|
101: private var graphicsPathChanged:Boolean = true;
|
220: graphicsPathChanged = true;
|
246: * Possible values are <code>GraphicsPathWinding.EVEN_ODD</code> or <code>GraphicsPathWinding.NON_ZERO</code>.
|
250: * @see flash.display.GraphicsPathWinding
|
262: graphicsPathChanged = true;
|
1085: graphicsPathChanged = true;
|
1092: if (graphicsPathChanged)
|
1099: graphicsPathChanged = false;
|
1139: graphicsPathChanged = true;
|
github.com/GNOME/gimp:tools/gimppath2svg.py: [ mainline, ] |
---|
43: class Path:
|
114: path = Path()
|
30: <path id="%s" transform="translate (%d,%d)"
|
55: path.name = namematch.group(1)
|
59: path.gimppoints.append ([])
|
61: path.gimppoints[-1].append (map (int, pointmatch.groups()))
|
71: for path in self.gimppoints:
|
72: if path:
|
73: start = path[0]
|
75: path = path[1:]
|
76: while path:
|
77: curve = path [0:3]
|
78: path = path[3:]
|
115: path.readgimpfile (infile)
|
116: path.makesvg()
|
117: path.writesvgfile (outfile)
|
6: gimppath2svg.py -- Converts Gimp-Paths to a SVG-File.
|
23: Usage: gimppath2svg.py [infile [outfile]]
|
46: self.svgpath = ""
|
89: self.svgpath = self.svgpath + svg
|
92: if self.svgpath:
|
97: self.svgpath)
|
android.googlesource.com/platform/external/python/parse_type:tasks/_vendor/path.py: [ master, ] |
---|
176: class Path(text_type):
|
1717: class path(Path):
|
294: def abspath(self):
|
302: def normpath(self):
|
306: def realpath(self):
|
383: def splitpath(self):
|
441: def joinpath(cls, first, *others):
|
475: def relpath(self, start='.'):
|
1141: def pathconf(self, name):
|
482: def relpathto(self, dest):
|
2: # SOURCE: https://pypi.python.org/pypi/path.py
|
27: path.py - An object representing a path to a file or directory.
|
29: https://github.com/jaraco/path.py
|
33: from path import Path
|
34: d = Path('/home/guido/bin')
|
113: __all__ = ['Path', 'CaseInsensitivePattern']
|
126: __version__ = pkg_resources.require('path.py')[0].version
|
143: Save results for the :meth:'path.using_module' classmethod.
|
178: Represents a filesystem path.
|
181: counterparts in :mod:`os.path`.
|
185: such that they will be bound to the Path instance. For example,
|
186: ``Path(src).copy(target)`` is equivalent to
|
189: the Path instance.
|
192: module = os.path
|
193: """ The path module to use for path operations.
|
195: .. seealso:: :mod:`os.path`
|
200: raise TypeError("Invalid initial value for path: None")
|
221: def _always_unicode(cls, path):
|
223: Ensure the path as retrieved from a Python API, such as :func:`os.listdir`,
|
226: if PY3 or isinstance(path, text_type):
|
227: return path
|
228: return path.decode(sys.getfilesystemencoding(), 'surrogateescape')
|
233: return '%s(%s)' % (type(self).__name__, super(Path, self).__repr__())
|
235: # Adding a Path and a string yields a Path.
|
238: return self._next_class(super(Path, self).__add__(more))
|
251: Join two path components, adding a separator character if
|
254: .. seealso:: :func:`os.path.join`
|
265: Join two path components, adding a separator character if
|
268: .. seealso:: :func:`os.path.join`
|
285: """ Return the current working directory as a path object.
|
292: # --- Operations on Path strings.
|
295: """ .. seealso:: :func:`os.path.abspath` """
|
299: """ .. seealso:: :func:`os.path.normcase` """
|
303: """ .. seealso:: :func:`os.path.normpath` """
|
307: """ .. seealso:: :func:`os.path.realpath` """
|
311: """ .. seealso:: :func:`os.path.expanduser` """
|
315: """ .. seealso:: :func:`os.path.expandvars` """
|
319: """ .. seealso:: :attr:`parent`, :func:`os.path.dirname` """
|
323: """ .. seealso:: :attr:`name`, :func:`os.path.basename` """
|
340: ``Path('/home/guido/python.tar.gz').name == 'python.tar.gz'``,
|
342: ``Path('/home/guido/python.tar.gz').namebase == 'python.tar'``.
|
364: """ This path's parent directory, as a new Path object.
|
367: ``Path('/usr/local/lib/libpython.so').parent ==
|
368: Path('/usr/local/lib')``
|
370: .. seealso:: :meth:`dirname`, :func:`os.path.dirname`
|
375: """ The name of this file or directory without the full path.
|
378: ``Path('/usr/local/lib/libpython.so').name == 'libpython.so'``
|
380: .. seealso:: :meth:`basename`, :func:`os.path.basename`
|
386: .. seealso:: :attr:`parent`, :attr:`name`, :func:`os.path.split`
|
394: Split the drive specifier from this path. If there is
|
396: is simply ``(Path(''), p)``. This is always the case on Unix.
|
398: .. seealso:: :func:`os.path.splitdrive`
|
406: Split the filename extension from this path and return
|
410: last path segment. This has the property that if
|
413: .. seealso:: :func:`os.path.splitext`
|
419: """ p.stripext() -> Remove one file extension from the path.
|
421: For example, ``Path('/home/guido/python.tar.gz').stripext()``
|
422: returns ``Path('/home/guido/python.tar')``.
|
427: """ .. seealso:: :func:`os.path.splitunc` """
|
434: The UNC mount point for this path.
|
443: Join first to zero or more :class:`Path` components, adding a separator
|
447: .. seealso:: :func:`os.path.join`
|
454: r""" Return a list of the path components in this path.
|
456: The first item in the list will be a Path. Its value will be
|
458: directory of this path (for example, ``'/'`` or ``'C:\\'``). The
|
461: ``path.Path.joinpath(*result)`` will yield the original path.
|
476: """ Return this path as a relative path,
|
483: """ Return a relative path from `self` to `dest`.
|
485: If there is no relative path from `self` to `dest`, for example if
|
528: The elements of the list are Path objects.
|
546: The elements of the list are Path objects.
|
559: The elements of the list are Path objects.
|
572: The iterator yields Path objects naming each child item of
|
713: attribute, it is applied to the name and path prior to comparison.
|
717: to :meth:`os.path.normcase`.
|
728: """ Return a list of Path objects that match the pattern.
|
730: `pattern` - a path relative to this directory, with wildcards.
|
732: For example, ``Path('/users').glob('*/bin/*')`` returns a list
|
766: >>> for chunk in Path("path.py").chunks(8192, mode='rb'):
|
902: By default this overwrites any existing file at this path.
|
956: """ Returns a hash object for the file at the current path.
|
987: # N.B. On some platforms, the os.path functions may be implemented in C
|
992: """ .. seealso:: :func:`os.path.isabs` """
|
996: """ .. seealso:: :func:`os.path.exists` """
|
1000: """ .. seealso:: :func:`os.path.isdir` """
|
1004: """ .. seealso:: :func:`os.path.isfile` """
|
1008: """ .. seealso:: :func:`os.path.islink` """
|
1012: """ .. seealso:: :func:`os.path.ismount` """
|
1016: """ .. seealso:: :func:`os.path.samefile` """
|
1018: other = Path(other).realpath().normpath().normcase()
|
1023: """ .. seealso:: :attr:`atime`, :func:`os.path.getatime` """
|
1030: .. seealso:: :meth:`getatime`, :func:`os.path.getatime`
|
1034: """ .. seealso:: :attr:`mtime`, :func:`os.path.getmtime` """
|
1041: .. seealso:: :meth:`getmtime`, :func:`os.path.getmtime`
|
1045: """ .. seealso:: :attr:`ctime`, :func:`os.path.getctime` """
|
1052: .. seealso:: :meth:`getctime`, :func:`os.path.getctime`
|
1056: """ .. seealso:: :attr:`size`, :func:`os.path.getsize` """
|
1063: .. seealso:: :meth:`getsize`, :func:`os.path.getsize`
|
1068: """ Return ``True`` if current user has access to this path.
|
1078: """ Perform a ``stat()`` system call on this path.
|
1134: """ Perform a ``statvfs()`` system call on this path.
|
1322: """ Return the path to which this symbolic link points.
|
1324: The result may be an absolute or a relative path.
|
1331: """ Return the path to which this symbolic link points.
|
1333: The result is always an absolute path.
|
1345: # Path(name).copy(target) will invoke shutil.copy(name, target)
|
1432: p = Path(filename)
|
1506: dir = Path.special().user.config
|
1514: dir = Path.special("My App").user.config.makedirs_p()
|
1531: def __init__(self, path_class, *args, **kwargs):
|
1539: path_class=path_class,
|
1549: result wrapped in self.path_class
|
1553: MultiPath = Multi.for_class(self.path_class)
|
1559: A mix-in for a Path which may contain multiple Path separated by pathsep.
|
1562: def for_class(cls, path_cls):
|
1563: name = 'Multi' + path_cls.__name__
|
1566: return type(name, (cls, path_cls), {})
|
1590: class tempdir(Path):
|
1598: # do stuff with the Path object "d"
|
1608: return Path
|
1707: from path import Path, CaseInsensitivePattern as ci
|
1708: Path('.').files(ci('*.py'))
|
1719: msg = "path is deprecated. Use Path instead."
|
1721: return Path.__new__(cls, *args, **kwargs)
|
1724: __all__ += ['path']
|
247: # The / operator joins Paths.
|
249: """ fp.__div__(rel) == fp / rel == fp.joinpath(rel)
|
261: # The / operator joins Paths the other way around
|
296: return self._next_class(self.module.abspath(self))
|
304: return self._next_class(self.module.normpath(self))
|
308: return self._next_class(self.module.realpath(self))
|
328: :meth:`expanduser()`, and :meth:`normpath()` on it.
|
333: return self.expandvars().expanduser().normpath()
|
384: """ p.splitpath() -> Return ``(p.parent, p.name)``.
|
435: This is empty for paths on local drives.
|
467: loc, child = prev.splitpath()
|
487: ``dest.abspath()``.
|
489: origin = self.abspath()
|
490: dest = self._next_class(dest).abspath()
|
500: # Find the location where the two paths start to differ.
|
507: # Now i is the point where the two paths diverge.
|
515: relpath = os.curdir
|
517: relpath = self.module.join(*segments)
|
518: return self._next_class(relpath)
|
1019: return self.realpath().normpath().normcase() == other
|
1140: if hasattr(os, 'pathconf'):
|
1142: """ .. seealso:: :func:`os.pathconf` """
|
1143: return os.pathconf(self, name)
|
1303: def link(self, newpath):
|
1304: """ Create a hard link at `newpath`, pointing to this file.
|
1308: os.link(self, newpath)
|
1309: return self._next_class(newpath)
|
1341: return (self.parent / p).abspath()
|
1510: the paths in a platform-friendly way.
|
1524: def __init__(self, paths, scope):
|
1525: self.paths = paths
|
1529: return self.paths.get_dir(self.scope, class_)
|
1554: return MultiPath.detect(value)
|
1570: if os.pathsep not in input:
|
1575: return iter(map(self._next_class, self.split(os.pathsep)))
|
1713: return __import__('ntpath').normcase
|
480: return cwd.relpathto(self)
|
chromium.googlesource.com/infra/third_party/virtualenv:src/virtualenv/util/path/_pathlib/via_os_path.py: [ master, ] |
---|
12: class Path(object):
|
13: def __init__(self, path):
|
14: if isinstance(path, Path):
|
15: _path = path._path
|
17: _path = ensure_text(path)
|
19: _path = _path.encode("utf-8")
|
20: self._path = _path
|
23: return ensure_str("Path({})".format(ensure_text(self._path)))
|
26: return ensure_text(self._path)
|
29: return ensure_str(self._path)
|
32: if isinstance(other, Path):
|
33: right = other._path
|
38: return Path(os.path.join(self._path, right))
|
44: return self._path == (other._path if isinstance(other, Path) else None)
|
50: return hash(self._path)
|
53: return os.path.exists(self._path)
|
57: return Path(os.path.abspath(os.path.join(self._path, os.path.pardir)))
|
60: return Path(os.path.realpath(self._path))
|
64: return os.path.basename(self._path)
|
68: return self._path.split(os.sep)
|
71: return os.path.isfile(self._path)
|
74: return os.path.isdir(self._path)
|
78: os.makedirs(self._path)
|
87: with open(self._path, "rb") as file_handler:
|
91: with open(self._path, "wb") as file_handler:
|
98: for p in os.listdir(self._path):
|
99: yield Path(os.path.join(self._path, p))
|
103: _, ext = os.path.splitext(self.name)
|
108: base, _ = os.path.splitext(self.name)
|
113: with open(self._path, mode) as file_handler:
|
121: result.append(Path(os.sep.join(parts[0 : i + 1])))
|
125: os.remove(self._path)
|
131: return os.path.islink(self._path)
|
134: if not self._path.startswith(other._path):
|
135: raise ValueError("{} does not start with {}".format(self._path, other._path))
|
136: return Path(os.sep.join(self.parts[len(other.parts) :]))
|
139: return os.stat(self._path)
|
142: os.chmod(self._path, mode)
|
145: return Path(os.path.abspath(self._path))
|
148: __all__ = ("Path",)
|
android.googlesource.com/platform/external/go-cmp:cmp/path.go: [ master, ] |
---|
26: type Path []PathStep
|
34: type PathStep interface {
|
151: type pathStep struct {
|
172: pathStep
|
211: pathStep
|
256: pathStep
|
270: pathStep
|
280: pathStep
|
290: pathStep
|
335: type pointerPath struct {
|
17: // Path is a list of PathSteps describing the sequence of operations to get
|
19: // The first Path element is always an operation-less PathStep that exists
|
37: // Type is the resulting type after performing the path step.
|
40: // Values is the resulting values after performing the path step.
|
65: func (pa *Path) push(s PathStep) {
|
69: func (pa *Path) pop() {
|
73: // Last returns the last PathStep in the Path.
|
74: // If the path is empty, this returns a non-nil PathStep that reports a nil Type.
|
75: func (pa Path) Last() PathStep {
|
79: // Index returns the ith step in the Path and supports negative indexing.
|
80: // A negative index starts counting from the tail of the Path such that -1
|
83: func (pa Path) Index(i int) PathStep {
|
93: // String returns the simplified path to a node.
|
94: // The simplified path only contains struct field accesses.
|
98: func (pa Path) String() string {
|
108: // GoString returns the path to a specific node using Go syntax.
|
112: func (pa Path) GoString() string {
|
329: // Path for whether px was ever encountered in the Path history of x, and
|
334: // in O(1) instead of O(N) where N is len(Path).
|
28: // PathStep is a union-type for specific operations to traverse
|
57: _ PathStep = StructField{}
|
58: _ PathStep = SliceIndex{}
|
59: _ PathStep = MapIndex{}
|
60: _ PathStep = Indirect{}
|
61: _ PathStep = TypeAssertion{}
|
62: _ PathStep = Transform{}
|
82: // If index is invalid, this returns a non-nil PathStep that reports a nil Type.
|
88: return pathStep{}
|
116: var nextStep PathStep
|
156: func (ps pathStep) Type() reflect.Type { return ps.typ }
|
157: func (ps pathStep) Values() (vx, vy reflect.Value) { return ps.vx, ps.vy }
|
158: func (ps pathStep) String() string {
|
308: // pointerPath represents a dual-stack of pointers encountered when
|
313: // The pointerPath uses a map to represent a stack; where descension into a
|
331: // equal if both px and py have a cycle resulting from the same PathStep.
|
342: func (p *pointerPath) Init() {
|
354: func (p pointerPath) Push(vx, vy reflect.Value) (equal, visited bool) {
|
369: func (p pointerPath) Pop(vx, vy reflect.Value) {
|
github.com/google/go-cmp:cmp/path.go: [ master, ] |
---|
26: type Path []PathStep
|
34: type PathStep interface {
|
153: type pathStep struct {
|
174: pathStep
|
213: pathStep
|
258: pathStep
|
272: pathStep
|
282: pathStep
|
292: pathStep
|
337: type pointerPath struct {
|
17: // Path is a list of PathSteps describing the sequence of operations to get
|
19: // The first Path element is always an operation-less PathStep that exists
|
37: // Type is the resulting type after performing the path step.
|
40: // Values is the resulting values after performing the path step.
|
65: func (pa *Path) push(s PathStep) {
|
69: func (pa *Path) pop() {
|
73: // Last returns the last PathStep in the Path.
|
74: // If the path is empty, this returns a non-nil PathStep that reports a nil Type.
|
75: func (pa Path) Last() PathStep {
|
79: // Index returns the ith step in the Path and supports negative indexing.
|
80: // A negative index starts counting from the tail of the Path such that -1
|
83: func (pa Path) Index(i int) PathStep {
|
93: // String returns the simplified path to a node.
|
94: // The simplified path only contains struct field accesses.
|
99: func (pa Path) String() string {
|
109: // GoString returns the path to a specific node using Go syntax.
|
114: func (pa Path) GoString() string {
|
331: // Path for whether px was ever encountered in the Path history of x, and
|
336: // in O(1) instead of O(N) where N is len(Path).
|
28: // PathStep is a union-type for specific operations to traverse
|
57: _ PathStep = StructField{}
|
58: _ PathStep = SliceIndex{}
|
59: _ PathStep = MapIndex{}
|
60: _ PathStep = Indirect{}
|
61: _ PathStep = TypeAssertion{}
|
62: _ PathStep = Transform{}
|
82: // If index is invalid, this returns a non-nil PathStep that reports a nil Type.
|
88: return pathStep{}
|
118: var nextStep PathStep
|
158: func (ps pathStep) Type() reflect.Type { return ps.typ }
|
159: func (ps pathStep) Values() (vx, vy reflect.Value) { return ps.vx, ps.vy }
|
160: func (ps pathStep) String() string {
|
310: // pointerPath represents a dual-stack of pointers encountered when
|
315: // The pointerPath uses a map to represent a stack; where descension into a
|
333: // equal if both px and py have a cycle resulting from the same PathStep.
|
344: func (p *pointerPath) Init() {
|
356: func (p pointerPath) Push(vx, vy reflect.Value) (equal, visited bool) {
|
371: func (p pointerPath) Pop(vx, vy reflect.Value) {
|
android.googlesource.com/platform/tools/gpu:service/path/path_binary.go: [ master, ] |
---|
6: package path
|
76: o.Array = obj.(Path)
|
113: Package: "path",
|
116: {Declared: "Array", Type: &schema.Interface{Name: "Path"}},
|
163: Package: "path",
|
218: Package: "path",
|
284: Package: "path",
|
334: Package: "path",
|
383: Package: "path",
|
412: o.Struct = obj.(Path)
|
449: Package: "path",
|
452: {Declared: "Struct", Type: &schema.Interface{Name: "Path"}},
|
505: Package: "path",
|
554: Package: "path",
|
592: o.Map = obj.(Path)
|
633: Package: "path",
|
636: {Declared: "Map", Type: &schema.Interface{Name: "Path"}},
|
722: Package: "path",
|
780: Package: "path",
|
812: o.Array = obj.(Path)
|
857: Package: "path",
|
860: {Declared: "Array", Type: &schema.Interface{Name: "Path"}},
|
914: Package: "path",
|
963: Package: "path",
|
chromium.googlesource.com/arc/arc:third_party/chromium-ppapi/third_party/blink/web_tests/paint/invalidation/clip/clip-path-in-mask-layer.html: [ master, ] |
---|
5: <path id="path" d="M0 0 L1 1 L0 1 Z"/>
|
8: <div style="width: 200px; height: 200px; background: blue; clip-path: url(#clip); will-change: transform"></div>
|
11: path.setAttribute('d', 'M0 0 L1 0 L1 1 L0 1 Z');
|
4: <clipPath id="clip" clipPathUnits='objectBoundingBox'>
|
6: </clipPath>
|
github.com/yeoman/doctor:lib/rules/node-path.js: [ master, ] |
---|
3: const path = require('path');
|
14: pathMismatch(npmRoot) {
|
29: function fixPath(filepath) {
|
48: const nodePaths = (process.env.NODE_PATH || '').split(path.delimiter).map(fixPath);
|
7: exports.description = 'NODE_PATH matches the npm root';
|
11: return message.get('node-path-npm-failure', {});
|
15: let msgPath = 'node-path-path-mismatch';
|
22: path: process.env.NODE_PATH,
|
30: let fixedPath = path.resolve(path.normalize(filepath.trim()));
|
44: if (process.env.NODE_PATH === undefined) {
|
18: msgPath += '-windows';
|
21: return message.get(msgPath, {
|
33: fixedPath = fs.realpathSync(fixedPath);
|
40: return fixedPath;
|
52: const npmRoot = fixPath(stdout);
|
55: return errors.pathMismatch(npmRoot);
|
54: if (nodePaths.indexOf(npmRoot) < 0) {
|
github.com/apache/flex-whiteboard:cframpton/adobe.next/frameworks/projects/spark/src/spark/primitives/Path.as: [ trunk, ] Duplicate result |
---|
android.googlesource.com/platform/packages/modules/common:proto/classpaths.proto: [ master, ] |
---|
31: string path = 1;
|
19: enum Classpath {
|
21: BOOTCLASSPATH = 1;
|
22: SYSTEMSERVERCLASSPATH = 2;
|
23: DEX2OATBOOTCLASSPATH = 3;
|
35: Classpath classpath = 2;
|
51: message ExportedClasspathsJars {
|
30: // Path on the filesystem for the jar.
|
27: // Individual entry in a classpath variable.
|
33: // Environ classpath variable this jar belongs to.
|
34: // Must be set to a known classpath.
|
37: // Minimum API level required for the jar to be included on the classpath.
|
39: // attribute, the jar will not be included in the classpath.
|
45: // attribute, the jar will not be included in the classpath.
|
53: // All jars that are exported as part of any classpath environ variable
|
github.com/apache/flex-whiteboard:espenskogen/frameworks/projects/spark/src/spark/primitives/Path.as: [ trunk, ] Duplicate result |
---|
android.googlesource.com/platform/external/go-etree:path.go: [ master, ] |
---|
84: type Path struct {
|
89: type ErrPath string
|
98: func CompilePath(path string) (Path, error) {
|
111: func MustCompilePath(path string) Path {
|
148: type pather struct {
|
211: func (c *compiler) parsePath(path string) []segment {
|
235: func splitPath(path string) []string {
|
163: func newPather() *pather {
|
13: A Path is a string that represents a search path through an etree starting
|
17: A Path consists of a series of slash-separated "selectors", each of which may
|
22: Although etree Path strings are structurally and behaviorally similar to XPath
|
31: / Select the root element when used at the start of a path.
|
54: Below are some examples of etree path strings.
|
88: // ErrPath is returned by path functions when an invalid etree path is provided.
|
91: // Error returns the string describing a path error.
|
100: segments := comp.parsePath(path)
|
102: return Path{nil}, comp.err
|
104: return Path{segments}, nil
|
109: // occurs. Use this function to create Paths when you know the path is
|
112: p, err := CompilePath(path)
|
119: // A segment is a portion of a path between "/" characters.
|
134: // path traversal.
|
140: // on a path filter in [brackets].
|
146: // a Path object. It collects and deduplicates all elements matching
|
147: // the path query.
|
156: // A node represents an element and the remaining path segments that
|
172: // traverse follows the path from the element e, collecting
|
173: // and then returning all elements that match the path's selectors
|
175: func (p *pather) traverse(e *Element, path Path) []*Element {
|
176: for p.queue.add(node{e, path.segments}); p.queue.len() > 0; {
|
182: // eval evalutes the current path node by applying the remaining
|
183: // path's selector rules against the node's element.
|
203: // A compiler generates a compiled path from a path string.
|
208: // parsePath parses an XPath-like string describing a path
|
212: // If path ends with //, fix it
|
213: if strings.HasSuffix(path, "//") {
|
214: path += "*"
|
219: // Check for an absolute path
|
220: if strings.HasPrefix(path, "/") {
|
222: path = path[1:]
|
225: // Split path into segments
|
226: for _, s := range splitPath(path) {
|
239: for i := 0; i+1 <= len(path); i++ {
|
240: if path[i] == '\'' {
|
242: } else if path[i] == '/' && !inquote {
|
243: pieces = append(pieces, path[start:i])
|
247: return append(pieces, path[start:])
|
250: // parseSegment parses a path segment between / characters.
|
251: func (c *compiler) parseSegment(path string) segment {
|
252: pieces := strings.Split(path, "[")
|
260: c.err = ErrPath("path has invalid filter [brackets].")
|
268: // parseSelector parses a selector at the start of a path segment.
|
269: func (c *compiler) parseSelector(path string) selector {
|
270: switch path {
|
280: return newSelectChildrenByTag(path)
|
292: // parseFilter parses a path filter contained within [brackets].
|
293: func (c *compiler) parseFilter(path string) filter {
|
294: if len(path) == 0 {
|
295: c.err = ErrPath("path contains an empty filter expression.")
|
300: eqindex := strings.Index(path, "='")
|
302: rindex := nextIndex(path, "'", eqindex+2)
|
303: if rindex != len(path)-1 {
|
304: c.err = ErrPath("path has mismatched filter quotes.")
|
308: key := path[:eqindex]
|
309: value := path[eqindex+2 : rindex]
|
319: c.err = ErrPath("path has unknown function " + name)
|
328: case path[0] == '@':
|
329: return newFilterAttr(path[1:])
|
330: case strings.HasSuffix(path, "()"):
|
331: name := path[:len(path)-2]
|
335: c.err = ErrPath("path has unknown function " + name)
|
337: case isInteger(path):
|
338: pos, _ := strconv.Atoi(path)
|
346: return newFilterChild(path)
|
412: func newSelectChildrenByTag(path string) *selectChildrenByTag {
|
413: s, l := spaceDecompose(path)
|
14: from the document root or an arbitrary element. Paths are used with the
|
23: strings (https://www.w3.org/TR/1999/REC-xpath-19991116/), they have a more
|
26: The following selectors are supported by etree paths:
|
92: func (err ErrPath) Error() string {
|
96: // CompilePath creates an optimized version of an XPath-like string that
|
101: if comp.err != ErrPath("") {
|
107: // MustCompilePath creates an optimized version of an XPath-like string that
|
126: func (seg *segment) apply(e *Element, p *pather) {
|
136: apply(e *Element, p *pather)
|
142: apply(p *pather)
|
145: // A pather is helper object that traverses an element tree using
|
157: // should be applied against it by the pather.
|
164: return &pather{
|
184: func (p *pather) eval(n node) {
|
205: err ErrPath
|
228: if c.err != ErrPath("") {
|
258: fpath := pieces[i]
|
259: if fpath[len(fpath)-1] != ']' {
|
263: seg.filters = append(seg.filters, c.parseFilter(fpath[:len(fpath)-1]))
|
353: func (s *selectSelf) apply(e *Element, p *pather) {
|
360: func (s *selectRoot) apply(e *Element, p *pather) {
|
371: func (s *selectParent) apply(e *Element, p *pather) {
|
381: func (s *selectChildren) apply(e *Element, p *pather) {
|
393: func (s *selectDescendants) apply(e *Element, p *pather) {
|
417: func (s *selectChildrenByTag) apply(e *Element, p *pather) {
|
435: func (f *filterPos) apply(p *pather) {
|
459: func (f *filterAttr) apply(p *pather) {
|
482: func (f *filterAttrVal) apply(p *pather) {
|
504: func (f *filterFunc) apply(p *pather) {
|
524: func (f *filterFuncVal) apply(p *pather) {
|
544: func (f *filterChild) apply(p *pather) {
|
568: func (f *filterChildText) apply(p *pather) {
|
github.com/apache/ode-console:src/vendor/jquery.xpath.js: [ master, ] |
---|
2981: cXSAnyURI.prototype.path = null;
|
6341: oObject.xpath = function(oQuery, sExpression, fNSResolver) {
|
6307: function fXPath_evaluate(oQuery, sExpression, fNSResolver) {
|
1879: function cPathExpr() {
|
1885: function fPathExpr_parse (oLexer, oStaticContext) {
|
72: oException_messages["XPTY0018"] = "The result of the last step in a path expression contains both nodes and atomic values";
|
73: oException_messages["XPTY0019"] = "The result of a step (other than the last step) in a path expression contains an atomic value.";
|
1905: , "Expected path step expression"
|
1917: , "Expected path step expression"
|
2970: this.path = sPath;
|
2988: + (this.path ? this.path : '')
|
4951: if (oUri.path.charAt(0) != '/') {
|
4952: var aUriSegments = oUri.path.split('/'),
|
4953: aBaseUriSegments = oBaseUri.path.split('/');
|
4972: oUri.path = aBaseUriSegments.join('/');
|
2: * jQuery XPath plugin v0.2.5
|
3: * https://github.com/ilinsky/jquery-xpath
|
7: * Includes xpath.js - XPath 2.0 implementation in JavaScript
|
8: * https://github.com/ilinsky/xpath.js
|
47: sNS_XPF = "http://www.w3.org/2005/xpath-functions",
|
2967: function cXSAnyURI(sScheme, sAuthority, sPath, sQuery, sFragment) {
|
6079: fResolveUri = oLXDOMAdapter_staticContext.getFunction('{' + "http://www.w3.org/2005/xpath-functions" + '}' + "resolve-uri"),
|
6302: oHTMLStaticContext.defaultFunctionNamespace = "http://www.w3.org/2005/xpath-functions";
|
6342: return fXPath_evaluate(oQuery instanceof cQuery ? oQuery : new cQuery(oQuery), sExpression, fNSResolver);
|
6347: oObject.xpath = function(sExpression, fNSResolver) {
|
6348: return fXPath_evaluate(this, sExpression, fNSResolver);
|
1569: return fPathExpr_parse(oLexer, oStaticContext);
|
1883: cPathExpr.prototype.items = null;
|
1891: var oPathExpr = new cPathExpr(),
|
1896: oPathExpr.items.push(new cFunctionCall(null, "root", sNS_XPF));
|
1898: oPathExpr.items.push(new cAxisStep("descendant-or-self", new cKindTest("node")));
|
1903: return oPathExpr.items[0]; if (sSlash == sDoubleSlash)
|
1909: oPathExpr.items.push(oExpr);
|
1913: oPathExpr.items.push(new cAxisStep("descendant-or-self", new cKindTest("node")));
|
1919: oPathExpr.items.push(oExpr);
|
1922: if (oPathExpr.items.length == 1)
|
1923: return oPathExpr.items[0];
|
1925: return oPathExpr;
|
1928: cPathExpr.prototype.evaluate = function (oContext) {
|
github.com/sourcegraph/srclib-javascript:lib/define-path-info.js: [ master, ] |
---|
3: var path = require("path");
|
453: path: scope,
|
522: path: "",
|
62: function resolveScopeCountPath(scope) {
|
142: var pathVisitor = walk.make({
|
557: module.exports.mapLinesPathToScopePath = function(ternServer, defInfo) {
|
607: module.exports.getPath = function(node) {
|
47: function getFilePathName(fileName) {
|
19: * @property {string} scope - scope path
|
28: * @property {string} path - path to class
|
36: * @return {string} path to given node in given file
|
100: * required parent properties and adjusting path
|
102: * @param {string} scope new scope (path)
|
316: if (def && def.path) {
|
317: pathMap[formPathForScope(fileName, node.object)] = def.path;
|
318: newScope = def.path;
|
326: if (def && def.path) {
|
327: pathMap[formPathForScope(fileName, node.object)] = def.path;
|
328: newScope = def.path;
|
341: newScope = util.formPath(def.path, "fn", '+' + node.property.name);
|
344: newScope = util.formPath(def.path, "fn", '-' + node.property.name);
|
347: newScope = util.formPath(def.path, "fn", node.property.name);
|
350: newScope = util.formPath(classDefinitions[currentClass].path, "prop", node.property.name);
|
438: // append /class/NAME to path being built
|
443: classDefinitions[currentClass].path = scope;
|
605: * @returns {string} computed path to given node
|
39: return util.formPath(fileName, data.start, data.end);
|
48: fileName = util.normalizePath(fileName);
|
69: return util.formPath(scope, scopeCountRes);
|
73: module.exports.pathMap = pathMap = {};
|
154: var newScope = util.formPath(scopeInfo.scope, "obj_def_prop");
|
158: newScope = util.formPath(newScope, obj.name);
|
160: newScope = util.formPath(newScope, property.value);
|
164: pathMap[key] = resolveScopeCountPath(newScope);
|
179: var newScope = util.formPath(scopeInfo.scope, "import");
|
185: newScope = resolveScopeCountPath(util.formPath(newScope, id.name));
|
186: pathMap[key] = newScope;
|
204: var newScope = util.formPath(scopeInfo.scope, "fn");
|
223: newScope = resolveScopeCountPath(util.formPath(newScope, name));
|
224: pathMap[formPathForScope(fileName, identNode)] = newScope;
|
228: newScope = resolveScopeCountPath(newScope);
|
240: var paramScope = resolveScopeCountPath(util.formPath(newScope, "param", param.name));
|
241: pathMap[formPathForScope(fileName, param)] = paramScope;
|
267: var newScope = resolveScopeCountPath(util.formPath(scopeInfo.scope, "var", decl.name));
|
268: pathMap[key] = newScope;
|
309: newScope = resolveScopeCountPath(util.formPath(scopeInfo.scope, "obj", node.object.name));
|
310: pathMap[formPathForScope(fileName, node.object)] = newScope;
|
353: newScope = resolveScopeCountPath(util.formPath(newScope, "prop", node.property.name));
|
356: pathMap[keyProp] = newScope;
|
371: var newScope = util.formPath(scopeInfo.scope, "obj");
|
375: objScope = util.formPath(objScope, "objType", node.objType.name);
|
378: var keyScope = util.formPath(objScope, "obj_key");
|
382: keyScope = resolveScopeCountPath(util.formPath(keyScope, node.properties[i].key.name));
|
383: pathMap[keyKey] = keyScope;
|
387: keyScope = resolveScopeCountPath(util.formPath(keyScope, node.properties[i].key.value));
|
388: pathMap[keyKey] = keyScope;
|
395: valScope = resolveScopeCountPath(util.formPath(valScope, "obj_val", node.properties[i].value.name));
|
396: pathMap[key_val] = valScope;
|
436: var scope = util.formPath(scopeInfo.scope, "class");
|
439: scope = resolveScopeCountPath(util.formPath(scope, node.id.name));
|
440: pathMap[formPathForScope(node.sourceFile.name, node.id)] = scope;
|
446: scope = resolveScopeCountPath(scope);
|
457: pathMap[util.formPath(node.sourceFile.name, node.start, node.start + "class".length)] = scope;
|
513: var visitor = extend({}, pathVisitor);
|
530: pathVisitor.ClassDeclaration(node, state, cb);
|
543: pathVisitor.MethodDefinition(node, state, cb);
|
562: var mapRes = pathMap[key];
|
577: methods: pathVisitor
|
578: }, null, pathVisitor);
|
608: return pathMap[formPathForScope(node.sourceFile.name, node)];
|
38: module.exports.formPathForScope = formPathForScope = function(fileName, data) {
|
163: var key = formPathForScope(fileName, property);
|
184: var key = formPathForScope(fileName, id);
|
266: var key = formPathForScope(fileName, decl);
|
355: keyProp = formPathForScope(fileName, node.property);
|
381: keyKey = formPathForScope(fileName, node.properties[i].key);
|
386: keyKey = formPathForScope(fileName, node.properties[i].key);
|
394: var key_val = formPathForScope(fileName, node.properties[i].value);
|
508: module.exports.initLocalFilesScopePaths = function(ternServer, localFiles) {
|
550: scope: getFilePathName(file.name),
|
558: var key = formPathForScope(defInfo.file, {
|
575: scope: getFilePathName(file.name),
|
android.googlesource.com/platform/external/perf_data_converter:src/quipper/scoped_temp_path.h: [ master, ] |
---|
22: const string& path() const { return path_; }
|
25: string path_;
|
17: class ScopedTempPath {
|
19: ScopedTempPath() {}
|
6: #define CHROMIUMOS_WIDE_PROFILING_SCOPED_TEMP_PATH_H_
|
5: #ifndef CHROMIUMOS_WIDE_PROFILING_SCOPED_TEMP_PATH_H_
|
20: // The temporary path will be removed when the object is destroyed.
|
33: // Create a temporary file. If successful, the path will be stored in
|
34: // |path_|. If not, |path_| will be an empty string.
|
43: // Create a temporary directory. If successful, the path will be stored in
|
44: // |path_|. If not, |path_| will be an empty string.
|
53: #endif // CHROMIUMOS_WIDE_PROFILING_SCOPED_TEMP_PATH_H_
|
21: virtual ~ScopedTempPath();
|
28: DISALLOW_COPY_AND_ASSIGN(ScopedTempPath);
|
31: class ScopedTempFile : public ScopedTempPath {
|
41: class ScopedTempDir : public ScopedTempPath {
|
github.com/google/capture-thread:example/paths.cc: [ current, ] |
---|
60: class Path : public ThreadCapture<Path> {
|
56: std::ostringstream path_;
|
34: class PathBuilder {
|
85: static std::string DelegateRootPath(const Path& path) {
|
89: static void DelegateLocalPath(const Path& path, PathBuilder* builder) {
|
95: class InRootPath : public Path {
|
97: InRootPath(const std::string& root_path)
|
101: std::string RootPath() const override { return root_path_; }
|
103: void AppendLocalPath(PathBuilder* builder) const override {
|
116: class InLocalPath : public Path {
|
118: InLocalPath(const std::string& local_path)
|
122: std::string RootPath() const override {
|
127: void AppendLocalPath(PathBuilder* builder) const override {
|
111: const std::string root_path_;
|
137: const std::string local_path_;
|
36: std::string String() const { return path_.str(); }
|
41: path_.str("");
|
42: path_ << component;
|
45: path_ << '/';
|
47: path_ << component;
|
86: return path.RootPath();
|
90: path.AppendLocalPath(builder);
|
94: // Sets the root path, which persists while the instance is in scope.
|
98: : root_path_(root_path), capture_to_(this) {}
|
115: // Sets the local path relative to the current root + local path.
|
119: : local_path_(local_path), capture_to_(this) {}
|
133: builder->Add(local_path_);
|
143: InLocalPath path("bin");
|
146: std::cerr << "Installing binary " << Path::Working() << std::endl;
|
152: InLocalPath path("lib");
|
155: std::cerr << "Installing library " << Path::Working() << std::endl;
|
160: void InstallProjectIn(const std::string& path) {
|
161: InRootPath root(path);
|
162: std::cerr << "Installing project in " << Path::Root() << std::endl;
|
33: // A helper class for building paths from components.
|
38: PathBuilder& Add(const std::string& component) {
|
59: // Tracks persistent root and local paths.
|
64: return GetCurrent()->RootPath();
|
72: PathBuilder builder;
|
74: GetCurrent()->AppendLocalPath(&builder);
|
82: virtual std::string RootPath() const = 0;
|
83: virtual void AppendLocalPath(PathBuilder* builder) const = 0;
|
106: DelegateLocalPath(*previous, builder);
|
124: return previous ? DelegateRootPath(*previous) : "";
|
131: DelegateLocalPath(*previous, builder);
|
145: InLocalPath file(target);
|
154: InLocalPath file(target);
|
github.com/apache/flex-whiteboard:rduartes/frameworks/projects/spark/src/spark/primitives/Path.as: [ trunk, ] Duplicate result |
---|
github.com/google/go-structeditor:structeditor/path.go: [ master, ] |
---|
24: type Path struct {
|
39: func StringToPath(s string) (*Path, error) {
|
49: func sliceToPath(slice []string) (*Path, error) {
|
69: func encodePath(s string) (*Path, error) {
|
23: // Path to a specific variable
|
29: // Name of struct field in path
|
33: // if nil, this Path refers to the top-level element
|
34: Next *Path
|
37: // Converts a string to a Path pointer. If the pointer is nil,
|
38: // the Path refers to the top-level ("current") element.
|
47: // Converts a string slice to a Path pointer. If the pointer is nil,
|
48: // the Path refers to the top-level ("current") element.
|
50: var first *Path
|
51: var cur *Path
|
68: // Encodes path part
|
75: return &Path{
|
80: return &Path{
|
85: // Appends the specified newElement to the path and
|
86: // returns the new root of the path.
|
87: func (p *Path) Append(newElement *Path) *Path {
|
88: var prevEl *Path
|
89: var curEl *Path
|
100: // Removes the last element from the path and returns
|
101: // the new root of the path
|
102: func (p *Path) RemoveLast() *Path {
|
106: var prevEl *Path
|
107: var curEl *Path
|
114: type VisitingFunc func(updatedPath *Path)
|
116: // Attaches the specified element to the path, runs the specified function, and
|
119: func (p *Path) Visiting(element *Path, doing VisitingFunc) {
|
125: func (p *Path) String() string {
|
44: return sliceToPath(sliced)
|
53: pathEl, err := encodePath(elt)
|
58: first = pathEl
|
60: cur.Next = pathEl
|
62: cur = pathEl
|
129: subpath := p.Next.String()
|
134: if subpath == "" {
|
137: return elt + "." + subpath
|
github.com/google/angular-directed-graph:paths.ts: [ master, ] |
---|
86: const path = createPathFromPointData(data);
|
61: export function curvedPath(
|
502: interface PathPointData {
|
296: function doesPathGoBackwards(
|
400: function createPathFromPointData(points: PathPointData[]): string {
|
21: * @fileOverview Utility methods to generate svg path strings.
|
27: * make the path more curved while lower values make it close to a regular line.
|
32: * When using generic path smoothing, this is the length in pixels that the
|
39: * a hypothetical path created as if they never existed. Points with distances
|
41: * the path.
|
59: * Converts an edge to a SVG path connecting it from src to dest.
|
83: // Generate metadata about every point in the path, then convert this to
|
84: // an svg path.
|
88: return path;
|
165: * path. See:
|
175: // path to curve in the direction of the "flow" of the layout (eg, top to
|
232: * after this point in the path. This results in a smoothing effect in the path,
|
235: * For example, in the path between X, Y, and Z: Y's control points would be
|
236: * placed where the C's are, as this path is parallel to X and Z.
|
268: * Returns true if the point at the given path index is relatively unimportant
|
269: * in terms of defining the overall path.
|
272: * of where the path would be anyways if the point were to never have existed.
|
281: // First and last points in a path are always important.
|
293: * Returns true if any line segement within the path goes againts the regular
|
394: // SVG PATH STRING GENERATION
|
398: * Converts point metadata to a SVG path string.
|
420: * Returns an SVG path string that moves the path cursor to the given point.
|
427: * Returns a SVG cubic bezier path string that connects from the current path
|
500: * Metadata about a point in the path.
|
514: * A basic 2d vector class to help with path calculations. Mutable.
|
166: * https://developer.mozilla.org/en-US/docs/Web/SVG/Tutorial/Paths#Bezier_Curves
|
171: ): PathPointData[] {
|
172: const pointsData: PathPointData[] = [];
|
217: ): PathPointData {
|
233: * but can sometimes create paths that curve too much.
|
249: ): PathPointData {
|
180: const goesBackwards = doesPathGoBackwards(points, layout);
|
github.com/apache/incubator-retired-hdt:site/lib/path.pm: [ master, ] |
---|
1: package path;
|
github.com/Polymer/polymer-css-build:lib/pathresolver.js: [ master, ] |
---|
13: const path = require('path').posix;
|
35: const pathname = path.relative(
|
36: path.dirname(parsedFrom.pathname), parsedTo.pathname);
|
54: let path = match.replace(/["']/g, "").slice(4, -1);
|
55: path = this.rewriteRelPath(importUrl, mainDocUrl, path);
|
56: return 'url("' + path + '")';
|
12: // Adapted from vulcanize's pathResolver, but only used for css text
|
26: rewriteRelPath: function rewriteRelPath(importUrl, mainDocUrl, relUrl) {
|
38: pathname,
|
github.com/kythe/llvmbzlgen:path/path.go: [ master, ] |
---|
18: package path
|
26: type Path []string
|
44: func ToPaths(paths []string) []Path {
|
17: // Package path implements path manipulation routines used by cmaketobzl.
|
21: "path/filepath"
|
25: // Path is a slice of string segments, representing a filesystem path.
|
28: // Split cleans and splits the system-delimited filesystem path.
|
29: func New(s string) Path {
|
35: return Path{"/"}
|
37: return append(Path{"/"}, strings.Split(s[1:], "/")...)
|
45: split := make([]Path, len(paths))
|
53: func (p Path) LessThan(o Path) bool {
|
66: // String returns the properly platform-delimited form of the path.
|
67: func (p Path) String() string {
|
74: // Append appends additional elements to the end of path, disregarding
|
76: func Append(p Path, ps ...Path) Path {
|
87: // AppendString appends additional string elements to the end of path.
|
88: func AppendString(p Path, elem ...string) Path {
|
93: func Join(p Path, ps ...Path) Path {
|
100: // JoinString joins path and any number of additional string elements, returning the result.
|
101: func JoinString(p Path, elem ...string) Path {
|
106: // path and returns that along with each path stripped of that prefix.
|
107: func SplitCommonRoot(paths []Path) (Path, []Path) {
|
112: result := make([]Path, len(paths))
|
120: // path and returns that along with each path stripped of that prefix as /-delimited strings.
|
130: // LongestCommonPrefix returns the longest shared Path prefix of all of the paths.
|
131: func LongestCommonPrefix(paths []Path) Path {
|
30: s = filepath.ToSlash(filepath.Clean(s))
|
43: // ToPaths cleans and splits each of the system-delimited filesystem paths.
|
46: for i, p := range paths {
|
52: // LessThan provides lexicographic ordering of Paths.
|
71: return filepath.Join([]string(p)...)
|
78: // Drop the leading '/' when appending/joining fully qualified paths.
|
92: // Join joins any number of paths and returns the result.
|
108: root := LongestCommonPrefix(paths)
|
110: return root, paths
|
113: for i, p := range paths {
|
121: func SplitCommonRootString(paths []string) (string, []string) {
|
122: root, stripped := SplitCommonRoot(ToPaths(paths))
|
132: switch len(paths) {
|
136: return paths[0]
|
138: min, max := paths[0], paths[0]
|
139: for _, p := range paths[1:] {
|
89: return Append(p, ToPaths(elem)...)
|
102: return Join(p, ToPaths(elem)...)
|
github.com/apache/sling-org-apache-sling-jcr-js-nodetypes:src/test/resources/expectedNTJSON/testCompletePathPropertyDefinition.json: [ master, ] |
---|
7: "path": "/myapp:myName/myapp:myChildNode/aSubChildNode",
|
8: "type": "Path"
|
11: "requiredType": "Path",
|
20: "name": "pathPropertyDef"
|
github.com/kubernetes/kubernetes:vendor/github.com/vmware/govmomi/vim25/types/types.go: [ master, ] |
---|
9535: Path string `xml:"path"`
|
16915: Path string `xml:"path"`
|
17155: Path string `xml:"path"`
|
18138: Path string `xml:"path"`
|
21824: Path string `xml:"path,omitempty"`
|
21861: Path []HostMultipathInfoPath `xml:"path"`
|
21910: Path []HostMultipathStateInfoPath `xml:"path,omitempty"`
|
22603: Path []HostPlugStoreTopologyPath `xml:"path,omitempty"`
|
22618: Path []string `xml:"path,omitempty"`
|
22630: Path []string `xml:"path,omitempty"`
|
23031: Path string `xml:"path"`
|
27814: Path string `xml:"path,omitempty"`
|
28964: Path string `xml:"path"`
|
31651: Path string `xml:"path"`
|
31667: Path string `xml:"path"`
|
33986: Path *ProfilePropertyPath `xml:"path,omitempty"`
|
37442: Path string `xml:"path"`
|
37469: Path string `xml:"path"`
|
37539: Path string `xml:"path"`
|
43419: Path string `xml:"path"`
|
1241: UserInputPath ProfilePropertyPath `xml:"userInputPath"`
|
1281: UserInputPath ProfilePropertyPath `xml:"userInputPath"`
|
3050: type ArrayOfHostMultipathInfoPath struct {
|
3051: HostMultipathInfoPath []HostMultipathInfoPath `xml:"HostMultipathInfoPath,omitempty"`
|
3058: type ArrayOfHostMultipathStateInfoPath struct {
|
3059: HostMultipathStateInfoPath []HostMultipathStateInfoPath `xml:"HostMultipathStateInfoPath,omitempty"`
|
3226: type ArrayOfHostPlugStoreTopologyPath struct {
|
3227: HostPlugStoreTopologyPath []HostPlugStoreTopologyPath `xml:"HostPlugStoreTopologyPath,omitempty"`
|
4442: type ArrayOfProfilePropertyPath struct {
|
4443: ProfilePropertyPath []ProfilePropertyPath `xml:"ProfilePropertyPath,omitempty"`
|
5657: VmfsPath string `xml:"vmfsPath"`
|
5902: FilePath string `xml:"filePath"`
|
6731: GuestFilePath string `xml:"guestFilePath"`
|
8433: ApplyPath ProfilePropertyPath `xml:"applyPath"`
|
8504: DevicePath string `xml:"devicePath"`
|
8784: DevicePath []string `xml:"devicePath,omitempty"`
|
8815: PropertyPath string `xml:"propertyPath"`
|
8899: type ConvertNamespacePathToUuidPath ConvertNamespacePathToUuidPathRequestType
|
9869: DirectoryPath string `xml:"directoryPath,omitempty"`
|
9892: DirectoryPath string `xml:"directoryPath,omitempty"`
|
11926: OldMountPath string `xml:"oldMountPath"`
|
12151: DirectoryPath string `xml:"directoryPath"`
|
12165: DatastorePath string `xml:"datastorePath"`
|
12191: FilePath string `xml:"filePath"`
|
12203: DatastorePath string `xml:"datastorePath"`
|
12654: VffsPath string `xml:"vffsPath"`
|
13030: type DisableMultipathPath DisableMultipathPathRequestType
|
13038: PathName string `xml:"pathName"`
|
15248: type EnableMultipathPath EnableMultipathPathRequestType
|
15256: PathName string `xml:"pathName"`
|
15891: VmfsPath string `xml:"vmfsPath"`
|
16116: VffsPath string `xml:"vffsPath"`
|
16117: DevicePath string `xml:"devicePath"`
|
16510: MetaDataPath *FaultToleranceMetaSpec `xml:"metaDataPath,omitempty"`
|
17146: type FindByDatastorePath FindByDatastorePathRequestType
|
17187: type FindByInventoryPath FindByInventoryPathRequestType
|
17195: InventoryPath string `xml:"inventoryPath"`
|
18114: DiskPath string `xml:"diskPath,omitempty"`
|
18388: ProgramPath string `xml:"programPath"`
|
18401: RegistryPath string `xml:"registryPath"`
|
19891: FolderPath string `xml:"folderPath,omitempty"`
|
20178: DevicePath string `xml:"devicePath,omitempty"`
|
21622: LocalPath string `xml:"localPath"`
|
21890: type HostMultipathInfoPath struct {
|
21895: PathState string `xml:"pathState"`
|
21897: IsWorkingPath *bool `xml:"isWorkingPath"`
|
21917: type HostMultipathStateInfoPath struct {
|
21921: PathState string `xml:"pathState"`
|
21932: RemotePath string `xml:"remotePath"`
|
21958: RemotePath string `xml:"remotePath"`
|
21959: LocalPath string `xml:"localPath"`
|
22637: type HostPlugStoreTopologyPath struct {
|
22660: ClaimedPath []string `xml:"claimedPath,omitempty"`
|
23241: DevicePath string `xml:"devicePath"`
|
23905: DevicePath string `xml:"devicePath"`
|
23921: ExtentDevicePath []string `xml:"extentDevicePath"`
|
23943: ExtentDevicePath []string `xml:"extentDevicePath"`
|
24082: DevicePath []string `xml:"devicePath,omitempty"`
|
24146: DevicePath string `xml:"devicePath"`
|
24769: CertPath string `xml:"certPath"`
|
25147: GuestFilePath string `xml:"guestFilePath"`
|
25168: GuestFilePath string `xml:"guestFilePath"`
|
25810: type InvalidDatastorePath struct {
|
25813: DatastorePath string `xml:"datastorePath"`
|
26206: RemotePath string `xml:"remotePath"`
|
26546: DnsSearchPath string `xml:"dnsSearchPath,omitempty"`
|
26791: type IscsiFaultVnicIsLastPath struct {
|
26868: PathStatus string `xml:"pathStatus,omitempty"`
|
27564: FilePath string `xml:"filePath"`
|
28159: DirectoryPath string `xml:"directoryPath"`
|
29208: SrcDirectoryPath string `xml:"srcDirectoryPath"`
|
29209: DstDirectoryPath string `xml:"dstDirectoryPath"`
|
29229: SrcFilePath string `xml:"srcFilePath"`
|
29230: DstFilePath string `xml:"dstFilePath"`
|
29504: RemotePath string `xml:"remotePath"`
|
29531: RemotePath string `xml:"remotePath"`
|
29559: RemotePath string `xml:"remotePath"`
|
31697: VmPath string `xml:"vmPath"`
|
33925: InputPath ProfilePropertyPath `xml:"inputPath"`
|
33999: InapplicablePath []string `xml:"inapplicablePath,omitempty"`
|
34129: type ProfilePropertyPath struct {
|
34132: ProfilePath string `xml:"profilePath"`
|
34201: ProfilePath ProfilePropertyPath `xml:"profilePath"`
|
34270: PathSet []string `xml:"pathSet,omitempty"`
|
34437: VffsPath string `xml:"vffsPath,omitempty"`
|
36255: DevicePath string `xml:"devicePath"`
|
36295: DevicePath string `xml:"devicePath"`
|
39523: DevicePath []string `xml:"devicePath"`
|
40506: DatastorePath string `xml:"datastorePath"`
|
40516: DatastorePath string `xml:"datastorePath"`
|
40975: PasswordFilePath string `xml:"passwordFilePath"`
|
41671: DevicePath string `xml:"devicePath"`
|
41824: StatePath string `xml:"statePath"`
|
44279: DevicePath string `xml:"devicePath"`
|
45487: VmfsPath string `xml:"vmfsPath"`
|
49433: PhysicalPath string `xml:"physicalPath"`
|
50718: ScreenshotFilePath string `xml:"screenshotFilePath"`
|
51600: ConfigPath string `xml:"configPath"`
|
51610: ConfigPath string `xml:"configPath"`
|
2050: type ArrayOfDatastoreMountPathDatastorePair struct {
|
2051: DatastoreMountPathDatastorePair []DatastoreMountPathDatastorePair `xml:"DatastoreMountPathDatastorePair,omitempty"`
|
3042: type ArrayOfHostMultipathInfoLogicalUnit struct {
|
3043: HostMultipathInfoLogicalUnit []HostMultipathInfoLogicalUnit `xml:"HostMultipathInfoLogicalUnit,omitempty"`
|
3170: type ArrayOfHostPathSelectionPolicyOption struct {
|
3171: HostPathSelectionPolicyOption []HostPathSelectionPolicyOption `xml:"HostPathSelectionPolicyOption,omitempty"`
|
8905: type ConvertNamespacePathToUuidPathRequestType struct {
|
8915: type ConvertNamespacePathToUuidPathResponse struct {
|
10867: VmDirectPathGen2Allowed *BoolPolicy `xml:"vmDirectPathGen2Allowed,omitempty"`
|
10902: VmDirectPathGen2Active *bool `xml:"vmDirectPathGen2Active"`
|
10903: VmDirectPathGen2InactiveReasonNetwork []string `xml:"vmDirectPathGen2InactiveReasonNetwork,omitempty"`
|
10904: VmDirectPathGen2InactiveReasonOther []string `xml:"vmDirectPathGen2InactiveReasonOther,omitempty"`
|
10905: VmDirectPathGen2InactiveReasonExtended string `xml:"vmDirectPathGen2InactiveReasonExtended,omitempty"`
|
11177: VmDirectPathGen2Supported bool `xml:"vmDirectPathGen2Supported"`
|
11923: type DatastoreMountPathDatastorePair struct {
|
13036: type DisableMultipathPathRequestType struct {
|
13045: type DisableMultipathPathResponse struct {
|
15254: type EnableMultipathPathRequestType struct {
|
15263: type EnableMultipathPathResponse struct {
|
16499: ConfigPaths []string `xml:"configPaths"`
|
17152: type FindByDatastorePathRequestType struct {
|
17162: type FindByDatastorePathResponse struct {
|
17193: type FindByInventoryPathRequestType struct {
|
17202: type FindByInventoryPathResponse struct {
|
19211: VmDirectPathGen2Supported *bool `xml:"vmDirectPathGen2Supported"`
|
19212: VmDirectPathGen2UnsupportedReason []string `xml:"vmDirectPathGen2UnsupportedReason,omitempty"`
|
19213: VmDirectPathGen2UnsupportedReasonExtended string `xml:"vmDirectPathGen2UnsupportedReasonExtended,omitempty"`
|
19495: MultipathState *HostMultipathStateInfo `xml:"multipathState,omitempty"`
|
21835: type HostMultipathInfo struct {
|
21845: type HostMultipathInfoFixedLogicalUnitPolicy struct {
|
21846: HostMultipathInfoLogicalUnitPolicy
|
21855: type HostMultipathInfoLogicalUnit struct {
|
21870: type HostMultipathInfoLogicalUnitPolicy struct {
|
21880: type HostMultipathInfoLogicalUnitStorageArrayTypePolicy struct {
|
21907: type HostMultipathStateInfo struct {
|
22531: type HostPathSelectionPolicyOption struct {
|
23611: MultipathInfo *HostMultipathInfo `xml:"multipathInfo,omitempty"`
|
25820: type InvalidDatastorePathFault InvalidDatastorePath
|
26711: type IscsiFaultVnicHasActivePaths struct {
|
26721: type IscsiFaultVnicHasActivePathsFault IscsiFaultVnicHasActivePaths
|
26801: type IscsiFaultVnicIsLastPathFault IscsiFaultVnicIsLastPath
|
33212: VmDirectPathGen2Supported *bool `xml:"vmDirectPathGen2Supported"`
|
33213: VmDirectPathGen2SupportedMode string `xml:"vmDirectPathGen2SupportedMode,omitempty"`
|
35660: type QueryPathSelectionPolicyOptions QueryPathSelectionPolicyOptionsRequestType
|
35666: type QueryPathSelectionPolicyOptionsRequestType struct {
|
35674: type QueryPathSelectionPolicyOptionsResponse struct {
|
41142: type SetMultipathLunPolicy SetMultipathLunPolicyRequestType
|
41148: type SetMultipathLunPolicyRequestType struct {
|
41158: type SetMultipathLunPolicyResponse struct {
|
45271: MountPathDatastoreMapping []DatastoreMountPathDatastorePair `xml:"mountPathDatastoreMapping"`
|
47949: VmDirectPathGen2Supported *bool `xml:"vmDirectPathGen2Supported"`
|
48535: VmPathName string `xml:"vmPathName"`
|
48665: VmDirectPathGen2Active bool `xml:"vmDirectPathGen2Active"`
|
48666: VmDirectPathGen2InactiveReasonVm []string `xml:"vmDirectPathGen2InactiveReasonVm,omitempty"`
|
48667: VmDirectPathGen2InactiveReasonOther []string `xml:"vmDirectPathGen2InactiveReasonOther,omitempty"`
|
48668: VmDirectPathGen2InactiveReasonExtended string `xml:"vmDirectPathGen2InactiveReasonExtended,omitempty"`
|
48723: VmPathName string `xml:"vmPathName,omitempty"`
|
51597: type VmReloadFromPathEvent struct {
|
51607: type VmReloadFromPathFailedEvent struct {
|
3055: t["ArrayOfHostMultipathInfoPath"] = reflect.TypeOf((*ArrayOfHostMultipathInfoPath)(nil)).Elem()
|
3063: t["ArrayOfHostMultipathStateInfoPath"] = reflect.TypeOf((*ArrayOfHostMultipathStateInfoPath)(nil)).Elem()
|
3231: t["ArrayOfHostPlugStoreTopologyPath"] = reflect.TypeOf((*ArrayOfHostPlugStoreTopologyPath)(nil)).Elem()
|
4447: t["ArrayOfProfilePropertyPath"] = reflect.TypeOf((*ArrayOfProfilePropertyPath)(nil)).Elem()
|
8902: t["ConvertNamespacePathToUuidPath"] = reflect.TypeOf((*ConvertNamespacePathToUuidPath)(nil)).Elem()
|
13033: t["DisableMultipathPath"] = reflect.TypeOf((*DisableMultipathPath)(nil)).Elem()
|
15251: t["EnableMultipathPath"] = reflect.TypeOf((*EnableMultipathPath)(nil)).Elem()
|
17149: t["FindByDatastorePath"] = reflect.TypeOf((*FindByDatastorePath)(nil)).Elem()
|
17190: t["FindByInventoryPath"] = reflect.TypeOf((*FindByInventoryPath)(nil)).Elem()
|
21904: t["HostMultipathInfoPath"] = reflect.TypeOf((*HostMultipathInfoPath)(nil)).Elem()
|
21925: t["HostMultipathStateInfoPath"] = reflect.TypeOf((*HostMultipathStateInfoPath)(nil)).Elem()
|
22651: t["HostPlugStoreTopologyPath"] = reflect.TypeOf((*HostPlugStoreTopologyPath)(nil)).Elem()
|
25817: t["InvalidDatastorePath"] = reflect.TypeOf((*InvalidDatastorePath)(nil)).Elem()
|
26798: t["IscsiFaultVnicIsLastPath"] = reflect.TypeOf((*IscsiFaultVnicIsLastPath)(nil)).Elem()
|
34138: t["ProfilePropertyPath"] = reflect.TypeOf((*ProfilePropertyPath)(nil)).Elem()
|
2055: t["ArrayOfDatastoreMountPathDatastorePair"] = reflect.TypeOf((*ArrayOfDatastoreMountPathDatastorePair)(nil)).Elem()
|
3047: t["ArrayOfHostMultipathInfoLogicalUnit"] = reflect.TypeOf((*ArrayOfHostMultipathInfoLogicalUnit)(nil)).Elem()
|
3175: t["ArrayOfHostPathSelectionPolicyOption"] = reflect.TypeOf((*ArrayOfHostPathSelectionPolicyOption)(nil)).Elem()
|
8912: t["ConvertNamespacePathToUuidPathRequestType"] = reflect.TypeOf((*ConvertNamespacePathToUuidPathRequestType)(nil)).Elem()
|
11931: t["DatastoreMountPathDatastorePair"] = reflect.TypeOf((*DatastoreMountPathDatastorePair)(nil)).Elem()
|
13042: t["DisableMultipathPathRequestType"] = reflect.TypeOf((*DisableMultipathPathRequestType)(nil)).Elem()
|
15260: t["EnableMultipathPathRequestType"] = reflect.TypeOf((*EnableMultipathPathRequestType)(nil)).Elem()
|
17159: t["FindByDatastorePathRequestType"] = reflect.TypeOf((*FindByDatastorePathRequestType)(nil)).Elem()
|
17199: t["FindByInventoryPathRequestType"] = reflect.TypeOf((*FindByInventoryPathRequestType)(nil)).Elem()
|
21838: Lun []HostMultipathInfoLogicalUnit `xml:"lun,omitempty"`
|
21842: t["HostMultipathInfo"] = reflect.TypeOf((*HostMultipathInfo)(nil)).Elem()
|
21852: t["HostMultipathInfoFixedLogicalUnitPolicy"] = reflect.TypeOf((*HostMultipathInfoFixedLogicalUnitPolicy)(nil)).Elem()
|
21862: Policy BaseHostMultipathInfoLogicalUnitPolicy `xml:"policy,typeattr"`
|
21863: StorageArrayTypePolicy *HostMultipathInfoLogicalUnitStorageArrayTypePolicy `xml:"storageArrayTypePolicy,omitempty"`
|
21867: t["HostMultipathInfoLogicalUnit"] = reflect.TypeOf((*HostMultipathInfoLogicalUnit)(nil)).Elem()
|
21877: t["HostMultipathInfoLogicalUnitPolicy"] = reflect.TypeOf((*HostMultipathInfoLogicalUnitPolicy)(nil)).Elem()
|
21887: t["HostMultipathInfoLogicalUnitStorageArrayTypePolicy"] = reflect.TypeOf((*HostMultipathInfoLogicalUnitStorageArrayTypePolicy)(nil)).Elem()
|
21914: t["HostMultipathStateInfo"] = reflect.TypeOf((*HostMultipathStateInfo)(nil)).Elem()
|
22538: t["HostPathSelectionPolicyOption"] = reflect.TypeOf((*HostPathSelectionPolicyOption)(nil)).Elem()
|
25823: t["InvalidDatastorePathFault"] = reflect.TypeOf((*InvalidDatastorePathFault)(nil)).Elem()
|
26718: t["IscsiFaultVnicHasActivePaths"] = reflect.TypeOf((*IscsiFaultVnicHasActivePaths)(nil)).Elem()
|
26724: t["IscsiFaultVnicHasActivePathsFault"] = reflect.TypeOf((*IscsiFaultVnicHasActivePathsFault)(nil)).Elem()
|
26804: t["IscsiFaultVnicIsLastPathFault"] = reflect.TypeOf((*IscsiFaultVnicIsLastPathFault)(nil)).Elem()
|
35663: t["QueryPathSelectionPolicyOptions"] = reflect.TypeOf((*QueryPathSelectionPolicyOptions)(nil)).Elem()
|
35671: t["QueryPathSelectionPolicyOptionsRequestType"] = reflect.TypeOf((*QueryPathSelectionPolicyOptionsRequestType)(nil)).Elem()
|
35675: Returnval []HostPathSelectionPolicyOption `xml:"returnval,omitempty"`
|
41145: t["SetMultipathLunPolicy"] = reflect.TypeOf((*SetMultipathLunPolicy)(nil)).Elem()
|
41151: Policy BaseHostMultipathInfoLogicalUnitPolicy `xml:"policy,typeattr"`
|
41155: t["SetMultipathLunPolicyRequestType"] = reflect.TypeOf((*SetMultipathLunPolicyRequestType)(nil)).Elem()
|