gmipf 6dddf7db37 Do not follow linked directories in SafeGetFiles outside of Windows (#8)
* Do not follow linked directories in SafeGetFiles outside of Windows

SafeGetFiles with SearchOption.AllDirectories follows directory symlinks.
On Linux, the UDF view of some PC/Mac hybrid discs has symlinks whose
target reads as empty, and each one resolves to its own folder, so the
recursion never ends (fixes #2, SabreTools/BinaryObjectScanner#276).

Outside of Windows, walk the tree one directory at a time and do not enter
directories that carry FileAttributes.ReparsePoint. Files are matched with
Directory.GetFiles per directory, so the pattern behaves as before, and the
order is the same breadth-first order. Windows keeps Directory.GetFiles.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Do not follow linked directories in the other AllDirectories overloads

SafeGetDirectories and the SafeEnumerateDirectories, SafeEnumerateFiles
and SafeEnumerateFileSystemEntries wrappers follow directory symlinks in
the same way. On Linux, with one directory linked to itself,
SafeEnumerateFiles returns 43 files instead of 2, and with three such
links it is still running after 10 seconds.

The walk from SafeGetFiles is now a lazy iterator that all of them share,
so the Enumerate wrappers stay lazy. Each directory is listed with the
matching overload without SearchOption (Directory.GetFiles,
SafeEnumerateFiles and so on), so patterns and inaccessible directories
behave as in the recursive search. If the attributes of a subdirectory
cannot be read, such as below a directory without execute permission, it
is entered anyway, so it fails in the same way as in the recursive search.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Check for linked directories without catching exceptions

DirectoryInfo.Exists returns false where the attributes cannot be read, and the criteria for the walk are checked one at a time with their reasons.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-10 13:52:11 +01:00
2025-11-17 08:40:06 -05:00
2026-08-28 13:00:14 -04:00
2026-10-12 09:47:53 -04:00
2026-08-28 13:00:14 -04:00
2026-10-12 09:47:53 -04:00
2026-08-28 13:00:14 -04:00
2026-10-12 09:47:53 -04:00
2026-08-28 13:00:14 -04:00
2026-08-28 13:00:14 -04:00
2026-08-28 13:00:14 -04:00
2026-10-12 09:47:53 -04:00
2026-01-25 17:04:11 -05:00
2026-07-10 09:54:37 -04:00
2026-03-23 10:50:09 -04:00

SabreTools.IO

Build and Test

This meta-library contains core functionality classes that is used by other SabreTools projects. The original version of the package which includes all namespaces below is in the SabreTools.IO.Meta directory.

Find the link to the Nuget package here.

Namespaces

Below are a list of the included namespaces with links to their README files:

Releases

For the most recent stable build, download the latest release here: Releases Page

For the latest WIP build here: Rolling Release

Description
No description provided
Readme 2.8 MiB
Latest
2025-11-14 01:02:30 +00:00
Languages
C# 99.8%
Shell 0.1%
PowerShell 0.1%