parent
a937b50d1b
commit
ef2c64067a
16
buffer/fs.py
16
buffer/fs.py
|
@ -1,13 +1,21 @@
|
|||
import fnmatch
|
||||
import dirutil, os
|
||||
from buffer import Buffer
|
||||
|
||||
ignore = ['*.o', '*.lo', '*.la', '#*#', '*.rej', '*~', '.#*', '.DS_Store',
|
||||
'*.pyc', '*.pyo', '.sconsign.dblite']
|
||||
|
||||
class DirBuffer(Buffer):
|
||||
btype = 'dir'
|
||||
def __init__(self, path, name=None):
|
||||
Buffer.__init__(self)
|
||||
self.path = os.path.realpath(path)
|
||||
|
||||
self.settings['hide-dot'] = True
|
||||
self.settings['type-sort'] = False
|
||||
self.settings['hide-glob'] = True
|
||||
self.settings['ignores'] = list(ignore)
|
||||
|
||||
def changed(self):
|
||||
return False
|
||||
def readonly(self):
|
||||
|
@ -36,6 +44,14 @@ class DirBuffer(Buffer):
|
|||
if self.settings.get('hide-dot'):
|
||||
if name.startswith('.') and name not in ('.', '..'):
|
||||
continue
|
||||
if self.settings.get('hide-glob'):
|
||||
skip = False
|
||||
for glob in self.settings.get('ignores', []):
|
||||
if fnmatch.fnmatch(name, glob):
|
||||
skip = True
|
||||
break
|
||||
if skip:
|
||||
continue
|
||||
path = self._make_path(name)
|
||||
fields = dirutil.path_fields(path, name)
|
||||
for i in range(0, 5):
|
||||
|
|
Loading…
Reference in New Issue