Symbolic link handling

This commit is contained in:
2026-09-22 12:53:29 -07:00
parent 73a06f3c94
commit 6c33951c81
2 changed files with 28 additions and 10 deletions
+17 -8
View File
@@ -61,14 +61,23 @@ def get_file_info_list(path: Path, extensions: Optional[tuple] = None) -> List[D
if extensions and not entry.name.lower().endswith(extensions):
continue
stats = entry.stat()
items.append({
"name": entry.name,
"path": entry,
"mtime": stats.st_mtime,
"size": stats.st_size,
"is_dir": entry.is_dir()
})
try:
stats = entry.lstat()
is_link = entry.is_symlink()
target = str(entry.readlink()) if is_link else None
items.append({
"name": entry.name,
"path": entry,
"mtime": stats.st_mtime,
"size": stats.st_size,
"is_dir": entry.is_dir(),
"is_link": is_link,
"target": target
})
except Exception:
# Skip items that are completely inaccessible
continue
except Exception as e:
raise ToolError(f"Error accessing directory {path}: {e}")