File tree Expand file tree Collapse file tree 2 files changed +13
-13
lines changed Expand file tree Collapse file tree 2 files changed +13
-13
lines changed Original file line number Diff line number Diff line change 4
4
"fmt"
5
5
"log"
6
6
"os"
7
- "path/filepath"
8
7
9
8
"gopkg.in/yaml.v3"
10
9
)
@@ -67,13 +66,3 @@ func load(file string) (config config) {
67
66
68
67
return
69
68
}
70
-
71
- func relativePath (p string ) string {
72
- ex , err := os .Executable ()
73
- if err != nil {
74
- panic (err )
75
- }
76
- path := filepath .Dir (ex )
77
-
78
- return fmt .Sprintf ("%s/%s" , path , p )
79
- }
Original file line number Diff line number Diff line change @@ -3,7 +3,9 @@ package main
3
3
import (
4
4
"flag"
5
5
"fmt"
6
+ "log"
6
7
"os"
8
+ "path/filepath"
7
9
)
8
10
9
11
type GoTv []Channel
@@ -16,8 +18,8 @@ type Channel struct {
16
18
}
17
19
18
20
func main () {
19
- configFile := flag .String ("config" , relativePath ("config.yml" ), "config file to read configuration from" )
20
- m3uFile := flag .String ("m3u" , relativePath ("gotv.m3u" ), "m3u file to save a new playlist into" )
21
+ configFile := flag .String ("config" , relPath ("config.yml" ), "config file to read configuration from" )
22
+ m3uFile := flag .String ("m3u" , relPath ("gotv.m3u" ), "m3u file to save a new playlist into" )
21
23
flag .Parse ()
22
24
23
25
config := load (* configFile )
@@ -29,3 +31,12 @@ func main() {
29
31
30
32
os .Exit (0 )
31
33
}
34
+
35
+ func relPath (p string ) string {
36
+ ex , err := os .Executable ()
37
+ if err != nil {
38
+ log .Fatal (err )
39
+ }
40
+
41
+ return filepath .Join (filepath .Dir (ex ), p )
42
+ }
You can’t perform that action at this time.
0 commit comments