File tree Expand file tree Collapse file tree 3 files changed +8
-7
lines changed Expand file tree Collapse file tree 3 files changed +8
-7
lines changed Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ package cl
33import (
44 "fmt"
55 "os/exec"
6+ "path/filepath"
67 "runtime"
78 "strconv"
89
@@ -30,7 +31,7 @@ func extractIndex(c *cli.Context) (int, error) {
3031// and sets up the command line commands.
3132func InitCli () * cli.App {
3233 dbpath := tv .DBPath ()
33- db , err := tv .RestoreProgrammeDB (dbpath + tv .NipDB )
34+ db , err := tv .RestoreProgrammeDB (filepath . Join ( dbpath , tv .NipDB ) )
3435 if err != nil {
3536 panic (err )
3637 }
Original file line number Diff line number Diff line change 55 "encoding/json"
66 "io/ioutil"
77 "os"
8+ "path/filepath"
89 "strings"
910 "time"
1011
@@ -284,13 +285,12 @@ func RefreshDB(filename string) {
284285
285286func init () {
286287 dbpath := DBPath ()
287- filename := NipDB
288- pdb , err := RestoreProgrammeDB (dbpath + filename )
288+ pdb , err := RestoreProgrammeDB (filepath .Join (dbpath , NipDB ))
289289 if err != nil {
290- RefreshDB (dbpath + filename )
290+ RefreshDB (filepath . Join ( dbpath , NipDB ) )
291291 } else {
292292 if pdb .sixHoursLater (time .Now ()) || len (pdb .Categories ) == 0 {
293- RefreshDB (dbpath + filename )
293+ RefreshDB (filepath . Join ( dbpath , NipDB ) )
294294 }
295295 }
296296 tobedel := pdb .toBeDeletedProgrammes ()
Original file line number Diff line number Diff line change @@ -341,13 +341,13 @@ func DBPath() string {
341341 }
342342 path = filepath .Join (path , "nip" )
343343 fmt .Println (path )
344- if _ , err := os .Stat (path + NipDB ); os .IsNotExist (err ) {
344+ if _ , err := os .Stat (filepath . Join ( path , NipDB ) ); os .IsNotExist (err ) {
345345 err := os .MkdirAll (path , os .ModePerm )
346346 if err != nil {
347347 log .Fatal (err )
348348 }
349349 pdb := & ProgrammeDB {[]* Category {}, time .Now (), []* SavedProgramme {}}
350- if err := pdb .Save (path + NipDB ); err != nil {
350+ if err := pdb .Save (filepath . Join ( path , NipDB ) ); err != nil {
351351 log .Fatal (err )
352352 }
353353 }
You can’t perform that action at this time.
0 commit comments