Browse files

Updated advancedfind to v3.2.1

  • Loading branch information...
1 parent 2348313 commit 1189efd239d7f980131bdc456a0ed47f4b6946cd @nengxu committed Oct 24, 2011
Showing with 15 additions and 4 deletions.
  1. +15 −4 plugins3/advancedfind/advancedfind.py
View
19 plugins3/advancedfind/advancedfind.py
@@ -484,10 +484,20 @@ def find_all_in_dir(self, parent_it, dir_path, file_pattern, search_pattern, fin
start_time = time.time()
if search_pattern == "":
return
-
- d_list = []
+
+ #d_list = []
file_list = []
+ if find_options['INCLUDE_SUBFOLDER'] == True:
+ grep_cmd = ['grep', '-E', '-l', '-R', search_pattern, dir_path]
+ else:
+ grep_cmd = ['grep', '-E', '-l', search_pattern, dir_path]
+ p = subprocess.Popen(grep_cmd, stdout=subprocess.PIPE)
+ for f in p.stdout:
+ if self.check_file_pattern(f, unicode(file_pattern, 'utf-8')):
+ file_list.append(f[:-1])
+
+ '''
for root, dirs, files in os.walk(unicode(dir_path, 'utf-8')):
for d in dirs:
d_list.append(os.path.join(root, d))
@@ -499,15 +509,16 @@ def find_all_in_dir(self, parent_it, dir_path, file_pattern, search_pattern, fin
if os.path.dirname(f) not in d_list:
file_list.append(os.path.join(root, f))
self.find_ui.do_events()
+ #'''
mid_time = time.time()
print 'Use ' + str(mid_time-start_time) + ' seconds to find files.'
-
for file_path in file_list:
if os.path.isfile(file_path):
temp_doc = Gedit.Document()
- file_uri = "file://" + urllib.pathname2url(file_path.encode('utf-8'))
+ #file_uri = "file://" + urllib.pathname2url(file_path.encode('utf-8'))
+ file_uri = ('file://' + file_path).encode('utf-8')
temp_doc.load(Gio.file_new_for_uri(file_uri), Gedit.encoding_get_from_charset('utf-8'), 0, 0, False)
f_temp = open(file_path, 'r')
try:

0 comments on commit 1189efd

Please sign in to comment.