From eef9549e9615912868bb4671cb17bf0020cfa395 Mon Sep 17 00:00:00 2001 From: Francisco Ryan Tolmasky I Date: Thu, 18 Feb 2010 11:17:21 -0800 Subject: [PATCH] Fix for HelloWorld/ not working when HelloWorld/index.html does. Closes #483. Reviewed by me. --- Objective-J/StaticResource.js | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/Objective-J/StaticResource.js b/Objective-J/StaticResource.js index 09853e75e..267ea8160 100644 --- a/Objective-J/StaticResource.js +++ b/Objective-J/StaticResource.js @@ -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