sstadick / cargo-bundle-licenses

Generate a THIRDPARTY file with all licenses in a cargo project.
Apache License 2.0
86 stars 6 forks source link

Move check for license-file outside of read_dir() loop #29

Closed jwodder closed 10 months ago

jwodder commented 10 months ago

Currently, find_package_license() checks whether a package has a license-file on every iteration through its read_dir() loop, but only if the current file doesn't have a recognized license name. Because the order in which read_dir() returns its values is filesystem-dependent (and may as well be non-deterministic), this can lead to situations like generic being set to the license-file and then later being reset to a generic license file if that happens to be the last file yielded. Presumably, what you want to happen is for generic to be set to the license-file if no generic license is found in the whole directory, which is what this PR accomplishes.

sstadick commented 10 months ago

Great fix. Thank you for the PR! I'll get a release out later today.

sstadick commented 10 months ago

v1.3.0 is up! Sorry for the delay.