]> git.lyx.org Git - features.git/blobdiff - lib/scripts/TeXFiles.py
Indicate see[also] refs in label and outliner
[features.git] / lib / scripts / TeXFiles.py
index aac29bc9d0e20c2c647586d27e00ef3608d933a8..a5787eaacba4ce01fa28adb16f1bc48af073bcb6 100755 (executable)
@@ -111,12 +111,23 @@ for type in types:
     
     file_ext = '.' + type
     out = open(outfile, 'w')
+    visited = set()
     for dir in dirs.split(path_sep):
         # for each valid directory
         if not os.path.isdir(dir):
             continue
         # walk down the file hierarchy
-        for root,path,files in os.walk(dir):
+        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: