exports["tests matches the literal character '\\' with option File::FNM_NOESCAPE"] = function() { FILE.mkdirs('foo?bar'); try { assert.eq(["foo?bar"], FILE.glob('foo?bar', FILE.FNM_NOESCAPE)); assert.eq([], FILE.glob('foo\\?bar', FILE.FNM_NOESCAPE)); } finally { FILE.rmdir('foo?bar'); } FILE.mkdir('foo\\?bar'); try { assert.eq(["foo\\?bar"], FILE.glob('foo\\?bar', FILE.FNM_NOESCAPE)); } finally { FILE.rmdir('foo\\?bar'); } }
this._resources.forEach(function(aResourcePath) { if (FILE.isDirectory(aResourcePath)) { // Add the directory itself as well since it is a legitimate resource as well. resources = resources.concat(aResourcePath, FILE.glob(aResourcePath + "/**")); } else resources.push(aResourcePath); });
this._resources.forEach(function(aResourcePath) { if (FILE.isDirectory(aResourcePath)) { resources = resources.concat(aResourcePath, FILE.glob(aResourcePath + "/**")); } else resources.push(aResourcePath); });
FileList.prototype._addMatching = function(/*String*/ aPattern) { FILE.glob(aPattern).forEach(function(fileName){ this._items.push(fileName); }, this); /* Dir[pattern].each do |fn| self << fn unless exclude?(fn) end*/ }
exports["tests returns nil for directories current user has no permission to read"] = function() { FILE.mkdirs('no_permission'); FILE.chmod('no_permission', 0); try { assert.eq(null, FILE.glob('no_permission/*')); } finally { FILE.rmdir('no_permission') } }
var loadTemplates = function loadTemplates() { var templates = {}; File.glob("templates/*.jshtml").forEach(function(template){ var templateName = template.substring("templates/".length); templateName = templateName.split(".")[0]; templates[templateName] = File.read(template, {charset:"UTF8"}); }); return templates; }