1122 return self.fncache[fn] |
1122 return self.fncache[fn] |
1123 |
1123 |
1124 # Search sys.path. |
1124 # Search sys.path. |
1125 for p in sys.path: |
1125 for p in sys.path: |
1126 afn = os.path.abspath(os.path.join(p, fn)) |
1126 afn = os.path.abspath(os.path.join(p, fn)) |
1127 afn = os.path.normcase(afn) |
1127 nafn = os.path.normcase(afn) |
1128 |
1128 |
1129 if os.path.exists(afn): |
1129 if os.path.exists(nafn): |
1130 self.fncache[fn] = afn |
1130 self.fncache[fn] = afn |
1131 d = os.path.dirname(afn) |
1131 d = os.path.dirname(afn) |
1132 if (d not in sys.path) and (d not in self.dircache): |
1132 if (d not in sys.path) and (d not in self.dircache): |
1133 self.dircache.append(d) |
1133 self.dircache.append(d) |
1134 return afn |
1134 return afn |
1135 |
1135 |
1136 # Search the additional directory cache |
1136 # Search the additional directory cache |
1137 for p in self.dircache: |
1137 for p in self.dircache: |
1138 afn = os.path.abspath(os.path.join(p, fn)) |
1138 afn = os.path.abspath(os.path.join(p, fn)) |
1139 afn = os.path.normcase(afn) |
1139 nafn = os.path.normcase(afn) |
1140 |
1140 |
1141 if os.path.exists(afn): |
1141 if os.path.exists(nafn): |
1142 self.fncache[fn] = afn |
1142 self.fncache[fn] = afn |
1143 return afn |
1143 return afn |
1144 |
1144 |
1145 # Nothing found. |
1145 # Nothing found. |
1146 return fn |
1146 return fn |