aboutsummaryrefslogtreecommitdiff
path: root/src/library_path.js
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2013-10-28 14:51:32 -0700
committerAlon Zakai <alonzakai@gmail.com>2013-10-28 14:51:32 -0700
commitb98b583f93c557ff3396cf1cc13146f9f878a9b0 (patch)
tree485bc391af1e504641b675185b05518cb6b5d6b4 /src/library_path.js
parent24a2894d567469a1c44430b4c6f43b5bbec41821 (diff)
optimize PATH.basename
Diffstat (limited to 'src/library_path.js')
-rw-r--r--src/library_path.js4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/library_path.js b/src/library_path.js
index 01476e8d..f00a7586 100644
--- a/src/library_path.js
+++ b/src/library_path.js
@@ -62,7 +62,9 @@ mergeInto(LibraryManager.library, {
basename: function(path) {
// EMSCRIPTEN return '/'' for '/', not an empty string
if (path === '/') return '/';
- return PATH.splitPath(path)[2];
+ var lastSlash = path.lastIndexOf('/');
+ if (lastSlash === -1) return path;
+ return path.substr(lastSlash+1);
},
extname: function(path) {
return PATH.splitPath(path)[3];