MCPcopy
hub / github.com/CodeboxIDE/codebox / pathToFsURL_

Function pathToFsURL_

client/vendors/filer.js:270–286  ·  view source on GitHub ↗
(path)

Source from the content-addressed store, hash-verified

268 // Path can be relative or absolute. If relative, it's taken from the cwd_.
269 // If a filesystem URL is passed it, it is simple returned
270 var pathToFsURL_ = function(path) {
271 if (!isFsURL_(path)) {
272 if (path[0] == '/') {
273 path = fs_.root.toURL() + path.substring(1);
274 } else if (path.indexOf('./') == 0 || path.indexOf('../') == 0) {
275 if (path == '../' && cwd_ != fs_.root) {
276 path = cwd_.toURL() + '/' + path;
277 } else {
278 path = cwd_.toURL() + path;
279 }
280 } else {
281 path = cwd_.toURL() + '/' + path;
282 }
283 }
284
285 return path;
286 };
287
288 /**
289 * Looks up a FileEntry or DirectoryEntry for a given path.

Callers 2

getEntry_Function · 0.85
filer.jsFile · 0.85

Calls 1

isFsURL_Function · 0.85

Tested by

no test coverage detected