Fix AbsolutePath UNC prefix loss causing NUL device crash during archive hashing by jakemismas · Pull Request #2891 · wabbajack-tools/wabbajack (original) (raw)

@jakemismas

…ve hashing

AbsolutePath.Parse() splits paths on \ and / with RemoveEmptyEntries, which permanently drops the leading \ from UNC and device paths. ToString() then joins the parts back without restoring that prefix. This means a path like \server\share\file round-trips to server\share\file, and .\nul becomes .\nul which Windows resolves right back to the NUL device.

When HashArchives calls Size() on one of these mangled paths, FileInfo tries to query the NUL device and throws: System.IO.IOException: The parameter is incorrect. : '.\nul'

This kills every Fallout 4 modlist install at the "Hashing Archives" step.

The fix has three parts:

  1. AbsolutePath now stores an _isUnc flag set during Parse(). ToString() checks this flag and re-adds the \ prefix for Windows UNC paths. All internal methods that create new AbsolutePath instances (Parent, Combine, ReplaceExtension, WithExtension) propagate the flag.

  2. Size() validates the path before calling FileInfo.Length. Empty paths and non-existent files now throw clear exceptions instead of hitting the Windows device path resolution.

  3. HashArchives filters the enumerated file list through FileExists(), dropping any paths that dont correspond to real files after the AbsolutePath round-trip.