xref: /aosp_15_r20/external/licenseclassifier/licenses/embed.go (revision 46c4c49da23cae783fa41bf46525a6505638499a)
1package licenses
2
3import (
4	"embed"
5	"io/fs"
6)
7
8// go:embed *.db *.txt
9var licenseFS embed.FS
10
11// ReadLicenseFile locates and reads the license archive file.  Absolute paths are used unmodified.  Relative paths are expected to be in the licenses directory of the licenseclassifier package.
12func ReadLicenseFile(filename string) ([]byte, error) {
13	return licenseFS.ReadFile(filename)
14}
15
16// ReadLicenseDir reads directory containing the license files.
17func ReadLicenseDir() ([]fs.DirEntry, error) {
18	return licenseFS.ReadDir(".")
19}
20