(self, dir_inner_path, ignore=None)
| 268 | |
| 269 | # List files from a directory |
| 270 | def walk(self, dir_inner_path, ignore=None): |
| 271 | directory = self.getPath(dir_inner_path) |
| 272 | for root, dirs, files in os.walk(directory): |
| 273 | root = root.replace("\\", "/") |
| 274 | root_relative_path = re.sub("^%s" % re.escape(directory), "", root).lstrip("/") |
| 275 | for file_name in files: |
| 276 | if root_relative_path: # Not root dir |
| 277 | file_relative_path = root_relative_path + "/" + file_name |
| 278 | else: |
| 279 | file_relative_path = file_name |
| 280 | |
| 281 | if ignore and SafeRe.match(ignore, file_relative_path): |
| 282 | continue |
| 283 | |
| 284 | yield file_relative_path |
| 285 | |
| 286 | # Don't scan directory that is in the ignore pattern |
| 287 | if ignore: |
| 288 | dirs_filtered = [] |
| 289 | for dir_name in dirs: |
| 290 | if root_relative_path: |
| 291 | dir_relative_path = root_relative_path + "/" + dir_name |
| 292 | else: |
| 293 | dir_relative_path = dir_name |
| 294 | |
| 295 | if ignore == ".*" or re.match(".*([|(]|^)%s([|)]|$)" % re.escape(dir_relative_path + "/.*"), ignore): |
| 296 | continue |
| 297 | |
| 298 | dirs_filtered.append(dir_name) |
| 299 | dirs[:] = dirs_filtered |
| 300 | |
| 301 | # list directories in a directory |
| 302 | def list(self, dir_inner_path): |
no test coverage detected