Skip to content

Commit d26f2a0

Browse files
committed
move to license/etc/
1 parent dd95d1b commit d26f2a0

File tree

3 files changed

+14
-8
lines changed

3 files changed

+14
-8
lines changed

build/generate-licenses.go

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,16 +23,14 @@ import (
2323

2424
func main() {
2525
var (
26-
prefix = "gitea-licenses"
27-
url = "https://api.github.com/repos/spdx/license-list-data/tarball"
28-
githubApiToken = ""
29-
githubUsername = ""
30-
destination = ""
31-
licenseAliasesDestination = ""
26+
prefix = "gitea-licenses"
27+
url = "https://api.github.com/repos/spdx/license-list-data/tarball"
28+
githubApiToken = ""
29+
githubUsername = ""
30+
destination = ""
3231
)
3332

3433
flag.StringVar(&destination, "dest", "options/license/", "destination for the licenses")
35-
flag.StringVar(&licenseAliasesDestination, "aliasesdest", "options/license-aliases.json", "destination for same license json")
3634
flag.StringVar(&githubUsername, "username", "", "github username")
3735
flag.StringVar(&githubApiToken, "token", "", "github api token")
3836
flag.Parse()
@@ -150,11 +148,19 @@ func main() {
150148
log.Fatalf("Failed to create json bytes. %s", err)
151149
return
152150
}
151+
152+
licenseAliasesDestination := path.Join(destination, "etc", "license-aliases.json")
153+
if err := os.MkdirAll(filepath.Dir(licenseAliasesDestination), 0o755); err != nil {
154+
log.Fatalf("Failed to create directory for license aliases json file. %s", err)
155+
return
156+
}
157+
153158
f, err := os.Create(licenseAliasesDestination)
154159
if err != nil {
155160
log.Fatalf("Failed to create license aliases json file. %s", err)
156161
}
157162
defer f.Close()
163+
158164
if _, err = f.Write(b); err != nil {
159165
log.Fatalf("Failed to write license aliases json file. %s", err)
160166
}
File renamed without changes.

services/repository/license.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ func loadLicenseAliases() error {
4343
return nil
4444
}
4545

46-
data, err := options.AssetFS().ReadFile("", "license-aliases.json")
46+
data, err := options.AssetFS().ReadFile("license", "etc", "license-aliases.json")
4747
if err != nil {
4848
return err
4949
}

0 commit comments

Comments
 (0)