biglybt: 3.5.0.0 -> 3.6.0.0
[NixPkgs.git] / pkgs / servers / dns / ncdns / fix-tpl-path.patch
blob850fb4d1b189fcb365605fa90f2d2f0618da282d
1 This sets a default value for the tpl directory that works for Nixpkgs.
3 diff --git a/server/web.go b/server/web.go
4 index d024a42..0522d02 100644
5 --- a/server/web.go
6 +++ b/server/web.go
7 @@ -10,6 +10,7 @@ import "path/filepath"
8 import "time"
9 import "strings"
10 import "fmt"
11 +import "os"
13 var layoutTpl *template.Template
14 var mainPageTpl *template.Template
15 @@ -44,7 +45,11 @@ func deriveTemplate(filename string) (*template.Template, error) {
18 func (s *Server) tplFilename(filename string) string {
19 - td := filepath.Join(s.cfg.ConfigDir, "..", "tpl")
20 + ex, err := os.Executable()
21 + if err != nil {
22 + panic(err)
23 + }
24 + td := filepath.Join(filepath.Dir(ex), "..", "share", "tpl")
25 if s.cfg.TplPath != "" {
26 td = s.cfg.TplPath