Documentation
¶
Overview ¶
Package pathutil provides cross-platform path sanitization utilities.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsolationFolderName ¶
IsolationFolderName generates a human-readable isolation folder name for hardlink cross-seeding. Format: <sanitized-name>--<shortHash>
This is used when torrents need isolation (e.g., rootless torrents with Original layout, or NoSubfolder layout) to prevent file conflicts while keeping the folder name readable and unique.
Example: "My.Movie.2024.1080p.BluRay--abcdef12"
func SanitizePathSegment ¶
SanitizePathSegment sanitizes a path segment (directory or file name) to be safe for use across platforms (Unix, Windows, macOS).
It performs the following transformations:
- Removes characters illegal in Windows: < > : " / \ | ? *
- Removes ASCII control characters (0x00-0x1F)
- Removes trailing dots and spaces (Windows restriction)
- Prefixes Windows reserved names (CON, PRN, etc.) with underscore
- Returns "_" if the result would be empty
func TorrentKey ¶
TorrentKey generates a stable, filesystem-safe directory key for a torrent. Uses the infohash as the primary identifier, falling back to sanitized name. The key is suitable for use as a directory name on any platform.
Types ¶
This section is empty.