Allow/handle hash files that do not contain the target file name

Javaru 11 months ago 0

When doing just an integrity check via a hash check file, TeraCopy requires the file name to be in the hash check file like this:
6bbe664ed6329e67dc4f3786417101ee21ed0a75 *filename.ext

Not all hash files will contain the name. They instead use the name of the hash file to indicate the name of the target file by having the same name but with the hash code type as an additional file extension. For example:

The hash file only contains the hash code and not the file name. This is very common in some ecosystems. For example the Maven ecosystem -- a build and dependency manager for Java with millions of artifacts and corresponding sha1 has files -- works this way. The same for the Gradle build ecosystem. As does numerous software installers I've downloaded over the years.

When you attempt to use TeraCopy to verify such files, you get an error as it tries to find a file with the name of hashcode:

Starting test using SHA-1...
Error opening source file: The system cannot find the file specified. Code: 2
Errors: 1. Finished testing "6bbe664ed6329e67dc4f3786417101ee21ed0a75"

TeraCopy should fall back to using the name of the has file being used to look for the file. Drop the has code based file extension and look for a file with that name. Thus if "filename.ext.sha1" was used to trigger the hash checker, it would look for a file named "filename.ext". It could wither do this 1) if it initially fails to find the file, or 2) be made to intelligent detect files that only contain a hash code corresponding to the file extension and in such cases use the alternate method to determine the name of the file to check.