UNPKG

3.3 kBTypeScriptView Raw
1export declare class Path {
2 static separator: '/';
3 static isDrive(segment: string): boolean;
4 /**
5 * vscode-uri always normalizes drive letters to lower case:
6 * https://github.com/Microsoft/vscode-uri/blob/b1d3221579f97f28a839b6f996d76fc45e9964d8/src/index.ts#L1025
7 * Theia path should be adjusted to this.
8 */
9 static normalizeDrive(path: string): string;
10 /**
11 * Normalize path separator to use Path.separator
12 * @param Path candidate to normalize
13 * @returns Normalized string path
14 */
15 static normalizePathSeparator(path: string): string;
16 /**
17 * Creates a windows path from the given path string.
18 * A windows path uses an upper case drive letter and backwards slashes.
19 * @param path The input path
20 * @returns Windows style path
21 */
22 static windowsPath(path: string): string;
23 /**
24 * Tildify path, replacing `home` with `~` if user's `home` is present at the beginning of the path.
25 * This is a non-operation for Windows.
26 *
27 * @param resourcePath
28 * @param home
29 */
30 static tildify(resourcePath: string, home: string): string;
31 /**
32 * Untildify path, replacing `~` with `home` if `~` present at the beginning of the path.
33 * This is a non-operation for Windows.
34 *
35 * @param resourcePath
36 * @param home
37 */
38 static untildify(resourcePath: string, home: string): string;
39 readonly isAbsolute: boolean;
40 readonly isRoot: boolean;
41 readonly root: Path | undefined;
42 readonly base: string;
43 readonly name: string;
44 readonly ext: string;
45 private _dir;
46 private readonly raw;
47 /**
48 * The raw should be normalized, meaning that only '/' is allowed as a path separator.
49 */
50 constructor(raw: string);
51 protected computeRoot(): Path | undefined;
52 /**
53 * Returns the parent directory if it exists (`hasDir === true`) or `this` otherwise.
54 */
55 get dir(): Path;
56 /**
57 * Returns `true` if this has a parent directory, `false` otherwise.
58 *
59 * _This implementation returns `true` if and only if this is not the root dir and
60 * there is a path separator in the raw path._
61 */
62 get hasDir(): boolean;
63 protected computeDir(): Path;
64 join(...paths: string[]): Path;
65 /**
66 *
67 * @param paths portions of a path
68 * @returns a new Path if an absolute path can be computed from the segments passed in + this.raw
69 * If no absolute path can be computed, returns undefined.
70 *
71 * Processes the path segments passed in from right to left (reverse order) concatenating until an
72 * absolute path is found.
73 */
74 resolve(...paths: string[]): Path | undefined;
75 toString(): string;
76 /**
77 * Converts the current path into a file system path.
78 * @param format Determines the format of the path.
79 * If `undefined`, the format will be determined by the `OS.backend.type` value.
80 * @returns A file system path.
81 */
82 fsPath(format?: Path.Format): string;
83 relative(path: Path): Path | undefined;
84 isEqualOrParent(path: Path): boolean;
85 relativity(path: Path): number;
86 normalize(): Path;
87}
88export declare namespace Path {
89 enum Format {
90 Posix = 0,
91 Windows = 1
92 }
93}
94//# sourceMappingURL=path.d.ts.map
\No newline at end of file