aboutsummaryrefslogtreecommitdiff
path: root/src/library_path.js
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2013-11-01 18:26:58 -0700
committerAlon Zakai <alonzakai@gmail.com>2013-11-01 18:26:58 -0700
commit3d48329892cd517b2e709ef94a00df8214169ddd (patch)
tree988d17b59d4fc2473a6d7a63df0f4117b711bcf4 /src/library_path.js
parent75af3c1ac8dba93b508b8b431bef9a35e6b054c3 (diff)
parent2c3d580bf9122ec4aef9ee8d462281d3fd810355 (diff)
Merge branch 'incoming' into f32
Conflicts: src/parseTools.js
Diffstat (limited to 'src/library_path.js')
-rw-r--r--src/library_path.js22
1 files changed, 9 insertions, 13 deletions
diff --git a/src/library_path.js b/src/library_path.js
index 09808acd..f00a7586 100644
--- a/src/library_path.js
+++ b/src/library_path.js
@@ -59,26 +59,22 @@ mergeInto(LibraryManager.library, {
}
return root + dir;
},
- basename: function(path, ext) {
+ basename: function(path) {
// EMSCRIPTEN return '/'' for '/', not an empty string
if (path === '/') return '/';
- var f = PATH.splitPath(path)[2];
- if (ext && f.substr(-1 * ext.length) === ext) {
- f = f.substr(0, f.length - ext.length);
- }
- return f;
+ var lastSlash = path.lastIndexOf('/');
+ if (lastSlash === -1) return path;
+ return path.substr(lastSlash+1);
},
extname: function(path) {
return PATH.splitPath(path)[3];
},
join: function() {
var paths = Array.prototype.slice.call(arguments, 0);
- return PATH.normalize(paths.filter(function(p, index) {
- if (typeof p !== 'string') {
- throw new TypeError('Arguments to path.join must be strings');
- }
- return p;
- }).join('/'));
+ return PATH.normalize(paths.join('/'));
+ },
+ join2: function(l, r) {
+ return PATH.normalize(l + '/' + r);
},
resolve: function() {
var resolvedPath = '',
@@ -134,4 +130,4 @@ mergeInto(LibraryManager.library, {
return outputParts.join('/');
}
}
-}); \ No newline at end of file
+});