]> git.lyx.org Git - lyx.git/blobdiff - lib/scripts/TeXFiles.py
GuiSearch: make search options visible/accessible in minimal mode
[lyx.git] / lib / scripts / TeXFiles.py
index aac29bc9d0e20c2c647586d27e00ef3608d933a8..16b7df2e8b2a2ec7e29bab2b4ba42b4a431e1931 100755 (executable)
@@ -116,7 +116,18 @@ for type in types:
         if not os.path.isdir(dir):
             continue
         # walk down the file hierarchy
-        for root,path,files in os.walk(dir):
+        visited = set()
+        for root,dirs,files in os.walk(dir, followlinks=True):
+            # prevent inifinite recursion
+            recurse = []
+            for dir in dirs:
+                dirname = os.path.join(root, dir)
+                dirname = os.path.realpath(dirname)
+                dirname = os.path.normcase(dirname)
+                if dirname not in visited:
+                    visited.add(dirname)
+                    recurse.append(dir)
+            dirs[:] = recurse
             # check file type
             for file in files:
                 if len(file) > 4 and file[-4:] == file_ext: