Module._resolvePath = function(script, parent) { var firstTerm = fs.split(script)[0]; var isRelative = (firstTerm == '.' || firstTerm == '..'); var parentPath = ''; if (isRelative) { if (parent) { parentPath = fs.directory(parent.filename); } else { // this will only occur for the root module parentPath = fs.workingDirectory(); } } else { if (Module.root) { parentPath = Module.root; } else { // this will only occur for the root module parentPath = fs.workingDirectory(); } } if (script.indexOf('.js') == -1) { return fs.join(parentPath, script+'.js'); } else { return fs.join(parentPath, script); } }
testFilesystem_cwd: function() { ok(fs.workingDirectory(), 'There should be a cwd'); },
exports["test: getDb(default)"] = function() { var got = maps.getDb(); var exp = fs.join(fs.workingDirectory(), "geoexplorer.db"); assert.equal(fs.canonical(got), fs.canonical(exp), "db location ./geoexplorer.db by default") };