MCPcopy Create free account
hub / github.com/diffusionstudio/vits-web / lookupPath

Function lookupPath

src/piper.js:1930–1967  ·  view source on GitHub ↗
(path, opts = {})

Source from the content-addressed store, hash-verified

1928 filesystems: null,
1929 syncFSRequests: 0,
1930 lookupPath(path, opts = {}) {
1931 path = PATH_FS.resolve(path);
1932 if (!path) return { path: '', node: null };
1933 var defaults = { follow_mount: true, recurse_count: 0 };
1934 opts = Object.assign(defaults, opts);
1935 if (opts.recurse_count > 8) {
1936 throw new FS.ErrnoError(32);
1937 }
1938 var parts = path.split('/').filter((p) => !!p);
1939 var current = FS.root;
1940 var current_path = '/';
1941 for (var i = 0; i < parts.length; i++) {
1942 var islast = i === parts.length - 1;
1943 if (islast && opts.parent) {
1944 break;
1945 }
1946 current = FS.lookupNode(current, parts[i]);
1947 current_path = PATH.join2(current_path, parts[i]);
1948 if (FS.isMountpoint(current)) {
1949 if (!islast || (islast && opts.follow_mount)) {
1950 current = current.mounted.root;
1951 }
1952 }
1953 if (!islast || opts.follow) {
1954 var count = 0;
1955 while (FS.isLink(current.mode)) {
1956 var link = FS.readlink(current_path);
1957 current_path = PATH_FS.resolve(PATH.dirname(current_path), link);
1958 var lookup = FS.lookupPath(current_path, { recurse_count: opts.recurse_count + 1 });
1959 current = lookup.node;
1960 if (count++ > 40) {
1961 throw new FS.ErrnoError(32);
1962 }
1963 }
1964 }
1965 }
1966 return { path: current_path, node: current };
1967 },
1968 getPath(node) {
1969 var path;
1970 while (true) {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected