Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding multiple folders to be searched for duplicates #175

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 29 additions & 24 deletions fslint-gui
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ time_commands=False #print sub commands timing on status line
def puts(string=""): #print is problematic in python 3
sys.stdout.write(str(string)+'\n')

BAD_DIRS = ['/lost+found','/dev','/proc','/sys','/tmp',
'*/.svn','*/CVS', '*/.git', '*/.hg', '*/.bzr',
'*/node_modules']

liblocation=os.path.dirname(os.path.abspath(sys.argv[0]))
locale_base=liblocation+'/po/locale'
try:
Expand Down Expand Up @@ -615,9 +619,7 @@ class fslint(GladeWrapper):
self.addDirs(self.ok_dirs, os.path.abspath(path))
else:
self.ShowErrors(_("Invalid path [") + path + "]")
for bad_dir in ['/lost+found','/dev','/proc','/sys','/tmp',
'*/.svn','*/CVS', '*/.git', '*/.hg', '*/.bzr',
'*/node_modules']:
for bad_dir in BAD_DIRS:
self.addDirs(self.bad_dirs, bad_dir)
self._alloc_mouse_cursors()
self.mode=0
Expand Down Expand Up @@ -1196,31 +1198,34 @@ on your system at present."))
def on_addOkDir_clicked(self, event):
self.dlgPath.show()
if not self.dlgPath.canceled:
path = self.dlgPath.GtkWindow.get_filename()
path = os.path.normpath(path)
self.addDirs(self.ok_dirs, path)
paths = self.dlgPath.GtkWindow.get_filenames()
for path in paths:
path = os.path.normpath(path)
self.addDirs(self.ok_dirs, path)

def on_addBadDir_clicked(self, event):
self.dlgPath.show()
if not self.dlgPath.canceled:
path = self.dlgPath.GtkWindow.get_filename()
path = os.path.normpath(path)
#Note find -path doesn't match dirs with trailing /
#and normpath strips trailing / among other things
#XXX: The following is not robust. We really should
#split specifying wildcards and paths
if not os.path.exists(path): #probably a wildcard?
#hacky way to get just user specified component
dirs = path.split('/')
if len(dirs) > 2:
for i in range(len(dirs)):
path = '/'.join(dirs[:i+1])
if path and not os.path.exists(path):
path = '/'.join(dirs[i:])
break
if '/' not in path:
path = "*/" + path #more accurate
self.addDirs(self.bad_dirs, path)
paths = self.dlgPath.GtkWindow.get_filenames()
for path in paths:
path = self.dlgPath.GtkWindow.get_filename()
path = os.path.normpath(path)
#Note find -path doesn't match dirs with trailing /
#and normpath strips trailing / among other things
#XXX: The following is not robust. We really should
#split specifying wildcards and paths
if not os.path.exists(path): #probably a wildcard?
#hacky way to get just user specified component
dirs = path.split('/')
if len(dirs) > 2:
for i in range(len(dirs)):
path = '/'.join(dirs[:i+1])
if path and not os.path.exists(path):
path = '/'.join(dirs[i:])
break
if '/' not in path:
path = "*/" + path #more accurate
self.addDirs(self.bad_dirs, path)

def on_removeOkDir_clicked(self, event):
self.removeDirs(self.ok_dirs)
Expand Down
Loading