Blacklist implemented

This commit is contained in:
Thomas Wilburn 2015-10-18 17:54:58 -07:00
parent 65e3a26cfa
commit 20fe5b64d8
3 changed files with 17 additions and 4 deletions

View file

@ -5,8 +5,9 @@ define([
"storage/file",
"util/template!templates/projectDir.html,templates/projectFile.html",
"ui/contextMenus",
"settings!user",
"util/dom2"
], function(M, elementData, sessions, File, inflate, context) {
], function(M, elementData, sessions, File, inflate, context, Settings) {
//TODO: implement a polling-based watch for directories
//TODO: pull the blacklist and use it during readdir()
@ -128,6 +129,18 @@ define([
var matched = [];
var added = [];
var oldChildren = self.children;
//filter out the blacklist
try {
var filter = Settings.get("user").ignoreFiles;
filter = new RegExp(filter);
entries = entries.filter(function(entry) {
//reject .directories
if (entry.name[0] == "." && entry.isDirectory) return false;
return !filter.test(entry.name);
});
} catch (e) {
console.log("Error applying blacklist", e, filter);
}
self.children = entries.map(function(entry) {
if (existing[entry.name]) {
return existing[entry.name];

View file

@ -11,11 +11,10 @@ define([
var directories = [];
var pathMap = {};
var container = document.find(".project");
container.addClass("show");
var tree = container.find(".tree");
var setVisible = function() {
if (this.directories.length) {
if (directories.length) {
container.addClass("show");
} else {
container.removeClass("show");
@ -24,6 +23,7 @@ define([
var addDirectory = function() {
chrome.fileSystem.chooseEntry({ type: "openDirectory" }, function(entry) {
if (!entry) return;
var root = new Node(entry);
directories.push(root);
var element = document.createElement("ul");

View file

@ -1,7 +1,7 @@
{
"name": "Caret",
"description": "Professional text editing for Chrome and Chrome OS",
"version": "1.5.13",
"version": "1.5.16",
"manifest_version": 2,
"default_locale": "en",
"icons": {