Fix up issue in node.js' impl of basename

This commit is contained in:
David Humphrey (:humph) david.humphrey@senecacollege.ca 2013-11-29 11:08:58 -05:00
parent c411aa1394
commit 00b7866874
2 changed files with 5 additions and 3 deletions

View File

@ -1721,7 +1721,8 @@ define(function(require) {
}; };
return { return {
FileSystem: FileSystem FileSystem: FileSystem,
Path: require('src/path')
}; };
}); });

View File

@ -67,7 +67,7 @@ define(function() {
resolvedAbsolute = false; resolvedAbsolute = false;
for (var i = arguments.length - 1; i >= -1 && !resolvedAbsolute; i--) { for (var i = arguments.length - 1; i >= -1 && !resolvedAbsolute; i--) {
var path = arguments[i]; var path = (i >= 0) ? arguments[i] : '/';
// Skip empty and invalid entries // Skip empty and invalid entries
if (typeof path !== 'string' || !path) { if (typeof path !== 'string' || !path) {
@ -182,7 +182,8 @@ define(function() {
if (ext && f.substr(-1 * ext.length) === ext) { if (ext && f.substr(-1 * ext.length) === ext) {
f = f.substr(0, f.length - ext.length); f = f.substr(0, f.length - ext.length);
} }
return f; // NOTE: node.js just does `return f`
return f === "" ? "/" : f;
} }
function extname(path) { function extname(path) {