diff options
author | Alon Zakai <alonzakai@gmail.com> | 2013-10-28 14:30:12 -0700 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2013-10-28 14:30:12 -0700 |
commit | b6342e4cedcdb4fcd8cb61b1879c0aa839e03f52 (patch) | |
tree | c2ff7f609f2d71456b7401871cdee53ffdf35956 /src/library_fs.js | |
parent | 03ad4ea44efa450c46405df7b048859841681782 (diff) |
add PATH.join2 as a fast way to join 2 path elements without the generic overhead of PATH.join
Diffstat (limited to 'src/library_fs.js')
-rw-r--r-- | src/library_fs.js | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/src/library_fs.js b/src/library_fs.js index 8aac29a4..409c8afd 100644 --- a/src/library_fs.js +++ b/src/library_fs.js @@ -63,7 +63,7 @@ mergeInto(LibraryManager.library, { } current = FS.lookupNode(current, parts[i]); - current_path = PATH.join(current_path, parts[i]); + current_path = PATH.join2(current_path, parts[i]); // jump to the mount's root node if this is a mountpoint if (FS.isMountpoint(current)) { @@ -95,9 +95,9 @@ mergeInto(LibraryManager.library, { var path; while (true) { if (FS.isRoot(node)) { - return path ? PATH.join(node.mount.mountpoint, path) : node.mount.mountpoint; + return path ? PATH.join2(node.mount.mountpoint, path) : node.mount.mountpoint; } - path = path ? PATH.join(node.name, path) : node.name; + path = path ? PATH.join2(node.name, path) : node.name; node = node.parent; } }, @@ -1189,7 +1189,7 @@ mergeInto(LibraryManager.library, { return ret; }, createFolder: function(parent, name, canRead, canWrite) { - var path = PATH.join(typeof parent === 'string' ? parent : FS.getPath(parent), name); + var path = PATH.join2(typeof parent === 'string' ? parent : FS.getPath(parent), name); var mode = FS.getMode(canRead, canWrite); return FS.mkdir(path, mode); }, @@ -1199,7 +1199,7 @@ mergeInto(LibraryManager.library, { while (parts.length) { var part = parts.pop(); if (!part) continue; - var current = PATH.join(parent, part); + var current = PATH.join2(parent, part); try { FS.mkdir(current); } catch (e) { @@ -1210,12 +1210,12 @@ mergeInto(LibraryManager.library, { return current; }, createFile: function(parent, name, properties, canRead, canWrite) { - var path = PATH.join(typeof parent === 'string' ? parent : FS.getPath(parent), name); + var path = PATH.join2(typeof parent === 'string' ? parent : FS.getPath(parent), name); var mode = FS.getMode(canRead, canWrite); return FS.create(path, mode); }, createDataFile: function(parent, name, data, canRead, canWrite, canOwn) { - var path = name ? PATH.join(typeof parent === 'string' ? parent : FS.getPath(parent), name) : parent; + var path = name ? PATH.join2(typeof parent === 'string' ? parent : FS.getPath(parent), name) : parent; var mode = FS.getMode(canRead, canWrite); var node = FS.create(path, mode); if (data) { @@ -1234,7 +1234,7 @@ mergeInto(LibraryManager.library, { return node; }, createDevice: function(parent, name, input, output) { - var path = PATH.join(typeof parent === 'string' ? parent : FS.getPath(parent), name); + var path = PATH.join2(typeof parent === 'string' ? parent : FS.getPath(parent), name); var mode = FS.getMode(!!input, !!output); if (!FS.createDevice.major) FS.createDevice.major = 64; var dev = FS.makedev(FS.createDevice.major++, 0); @@ -1288,7 +1288,7 @@ mergeInto(LibraryManager.library, { return FS.mkdev(path, mode, dev); }, createLink: function(parent, name, target, canRead, canWrite) { - var path = PATH.join(typeof parent === 'string' ? parent : FS.getPath(parent), name); + var path = PATH.join2(typeof parent === 'string' ? parent : FS.getPath(parent), name); return FS.symlink(target, path); }, // Makes sure a file's contents are loaded. Returns whether the file has @@ -1478,7 +1478,7 @@ mergeInto(LibraryManager.library, { Browser.init(); // TODO we should allow people to just pass in a complete filename instead // of parent and name being that we just join them anyways - var fullname = name ? PATH.resolve(PATH.join(parent, name)) : parent; + var fullname = name ? PATH.resolve(PATH.join2(parent, name)) : parent; function processData(byteArray) { function finish(byteArray) { if (!dontCreateFile) { |