Fix for HelloWorld/ not working when HelloWorld/index.html does.

Closes #483.

Reviewed by me.
This commit is contained in:
Francisco Ryan Tolmasky I committed 2010-02-18 11:17:21 -08:00
1 parent 9fd79488f8
commit eef9549e96
1 file changed
+10 -3
+10 -3
View File
@@ -104,12 +104,19 @@ require("file");
}
}
var DOMBaseElement = document.getElementsByTagName("base")[0];
var path = window.location.pathname,
DOMBaseElement = document.getElementsByTagName("base")[0];
if (DOMBaseElement)
FILE._cwd = FILE.dirname(DOMBaseElement.getAttribute("href"));
path = DOMBaseElement.getAttribute("href");
// If this is a directory, then use it as our relative path.
if (path.charAt(path.length - 1) === "/")
FILE._cwd = path;
// If not, use it's parent.
else
FILE._cwd = FILE.dirname(window.location.pathname);
FILE._cwd = FILE.dirname(path);
#endif