1
0
mirror of https://github.com/arsenetar/dupeguru.git synced 2026-02-03 20:01:38 +00:00

dgse cocoa: fixed quirks created by the hsfs move.

--HG--
extra : convert_revision : svn%3Ac306627e-7827-47d3-bdf0-9a457c9553a1/trunk%40203
This commit is contained in:
hsoft
2009-10-23 13:46:18 +00:00
parent cf44c93013
commit 4d7f032889
5 changed files with 28 additions and 15 deletions

View File

@@ -242,8 +242,11 @@ class DupeGuru(app.DupeGuru):
return [len(g.dupes) for g in self.results.groups]
elif tag == 1: #Directories
try:
path = self.get_folder_path(node_path)
subfolders = self.directories.get_subfolders(path)
if node_path:
path = self.get_folder_path(node_path)
subfolders = self.directories.get_subfolders(path)
else:
subfolders = self.directories
return [len(self.directories.get_subfolders(path)) for path in subfolders]
except IndexError: # node_path out of range
return []
@@ -269,7 +272,8 @@ class DupeGuru(app.DupeGuru):
elif tag == 1: #Directories
try:
path = self.get_folder_path(node_path)
return [path[-1], self.directories.get_state(path)]
name = unicode(path) if len(node_path) == 1 else path[-1]
return [name, self.directories.get_state(path)]
except IndexError: # node_path out of range
return []

View File

@@ -62,13 +62,17 @@ class Directories(object):
if not any(p[:len(from_path)] == from_path for p in self.states):
return
try:
subdir_paths = [from_path + name for name in io.listdir(from_path) if io.isdir(from_path + name)]
for subdir_path in subdir_paths:
for file in self._get_files(subdir_path):
yield file
filepaths = set()
if state != STATE_EXCLUDED:
for file in fs.get_files(from_path, fileclasses=self.fileclasses):
file.is_ref = state == STATE_REFERENCE
filepaths.add(file.path)
yield file
subpaths = [from_path + name for name in io.listdir(from_path)]
# it's possible that a folder (bundle) gets into the file list. in that case, we don't want to recurse into it
subfolders = [p for p in subpaths if not io.islink(p) and io.isdir(p) and p not in filepaths]
for subfolder in subfolders:
for file in self._get_files(subfolder):
yield file
except (EnvironmentError, fs.InvalidPath):
pass

View File

@@ -174,6 +174,10 @@ def get_files(path, fileclasses=[File]):
raise InvalidPath(path)
def get_all_files(path, fileclasses=[File]):
subfolders = [path + name for name in io.listdir(path) if not io.islink(path + name) and io.isdir(path + name)]
files = get_files(path, fileclasses=fileclasses)
filepaths = set(f.path for f in files)
subpaths = [path + name for name in io.listdir(path)]
# it's possible that a folder (bundle) gets into the file list. in that case, we don't want to recurse into it
subfolders = [p for p in subpaths if not io.islink(p) and io.isdir(p) and p not in filepaths]
subfiles = flatten(get_all_files(subpath, fileclasses=fileclasses) for subpath in subfolders)
return subfiles + get_files(path, fileclasses=fileclasses)
return subfiles + files