diff --git a/packages/cory/wiki/wiki.js b/packages/cory/wiki/wiki.js index e5ba03162..24ff26fbc 100644 --- a/packages/cory/wiki/wiki.js +++ b/packages/cory/wiki/wiki.js @@ -124,7 +124,7 @@ function editPage(event) { } // XXX: Why do I need .js? -require("ui.js").fileList({ +require("ui").fileList({ title: "Live Markdeep Editor", edit: editPage, }); \ No newline at end of file diff --git a/src/Task.cpp b/src/Task.cpp index ff696a734..33d3e7a9f 100644 --- a/src/Task.cpp +++ b/src/Task.cpp @@ -726,15 +726,20 @@ void Task::configureFromStdin() { std::string Task::resolveRequire(const std::string& require) { std::string result; - for (size_t i = 0; i < _path.size(); ++i) { std::string& path = _path[i]; std::cout << "Looking in " << path << " for " << require << "\n"; + std::string test; if (require.find("..") == std::string::npos && require.find('/') == std::string::npos) { - result = path + require; + test = path + require; } - if (result.size() && require.rfind(".js") != require.size() - 3) { - result += ".js"; + if (test.size() && (require.size() < 3 || require.rfind(".js") != require.size() - 3)) { + test += ".js"; + } + uv_fs_t request; + if (uv_fs_access(_loop, &request, test.c_str(), R_OK, 0) == 0) { + result = test; + break; } } return result;