mirror of
https://github.com/pulsar-edit/pulsar.git
synced 2024-09-21 16:08:24 +03:00
Remove unneeded regex matching for built-in ignores
This commit is contained in:
parent
f71b90578e
commit
71c161d527
@ -121,6 +121,7 @@ bool Native::Execute(const CefString& name,
|
||||
strncpy(relative, entry->fts_path + rootPathLength, pathLength);
|
||||
args.clear();
|
||||
args.push_back(CefV8Value::CreateString(relative));
|
||||
args.push_back(CefV8Value::CreateString(entry->fts_name));
|
||||
args.push_back(CefV8Value::CreateBool((entry->fts_info & FTS_F) != 0));
|
||||
if (!function->ExecuteFunction(function, args)->GetBoolValue())
|
||||
fts_set(tree, entry, FTS_SKIP);
|
||||
|
@ -22,10 +22,13 @@ class Project
|
||||
@setPath(path)
|
||||
@editSessions = []
|
||||
@buffers = []
|
||||
@ignoredPathRegexes = [
|
||||
/\.DS_Store$/
|
||||
/(^|\/)\.git(\/|$)/
|
||||
@ignoredFolderNames = [
|
||||
'.git'
|
||||
]
|
||||
@ignoredFileNames = [
|
||||
'.DS_Store'
|
||||
]
|
||||
@ignoredPathRegexes = []
|
||||
|
||||
destroy: ->
|
||||
editSession.destroy() for editSession in @getEditSessions()
|
||||
@ -52,19 +55,26 @@ class Project
|
||||
|
||||
filePaths = []
|
||||
|
||||
fs.traverseTree @getPath(), (path, isFile) =>
|
||||
if @ignorePath(path)
|
||||
false
|
||||
else if isFile
|
||||
filePaths.push path
|
||||
false
|
||||
else
|
||||
true
|
||||
fs.traverseTree @getPath(), (path, name, isFile) =>
|
||||
return false if @ignorePath(path, name, isFile)
|
||||
filePaths.push path if isFile
|
||||
return not isFile
|
||||
deferred.resolve filePaths
|
||||
deferred
|
||||
|
||||
ignorePath: (path) ->
|
||||
_.find @ignoredPathRegexes, (regex) -> path.match(regex)
|
||||
|
||||
ignorePath: (path, name, isFile) ->
|
||||
if isFile
|
||||
for ignored in @ignoredFileNames
|
||||
return true if name is ignored
|
||||
else
|
||||
for ignored in @ignoredFolderNames
|
||||
return true if name is ignored
|
||||
|
||||
for regex in @ignoredPathRegexes
|
||||
return true if path.match(regex)
|
||||
|
||||
return false
|
||||
|
||||
ignorePathRegex: ->
|
||||
@ignoredPathRegexes.map((regex) -> "(#{regex.source})").join("|")
|
||||
|
Loading…
Reference in New Issue
Block a user