MCPcopy
hub / github.com/jvilk/BrowserFS / _getFs

Method _getFs

src/backend/MountableFileSystem.ts:138–153  ·  view source on GitHub ↗

* Returns the file system that the path points to.

(path: string)

Source from the content-addressed store, hash-verified

136 * Returns the file system that the path points to.
137 */
138 public _getFs(path: string): {fs: FileSystem; path: string} {
139 const mountList = this.mountList, len = mountList.length;
140 for (let i = 0; i < len; i++) {
141 const mountPoint = mountList[i];
142 // We know path is normalized, so it is a substring of the mount point.
143 if (mountPoint.length <= path.length && path.indexOf(mountPoint) === 0) {
144 path = path.substr(mountPoint.length > 1 ? mountPoint.length : 0);
145 if (path === '') {
146 path = '/';
147 }
148 return {fs: this.mntMap[mountPoint], path: path};
149 }
150 }
151 // Query our root file system.
152 return {fs: this.rootFs, path: path};
153 }
154
155 // Global information methods
156

Callers 7

renameMethod · 0.95
renameSyncMethod · 0.95
readdirSyncMethod · 0.95
readdirMethod · 0.95
rmdirSyncMethod · 0.95
rmdirMethod · 0.95
defineFcnFunction · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected