Closed itsyourap closed 1 week ago
I put the line
log.Println("INFO: Using path prefix:", config.Cfg.PathPrefix)
at the beginning of GetPathPrefix()
function and here is the output.
As you can see, GetPathPrefix()
function was called once before actually reading the config file. Then, after reading the config file, it was called again.
The GetPathPrefix()
function is called at https://github.com/rabilrbl/jiotv_go/blob/f34465e7fb35ed80c73306367ee1b7e20aa1dbb7/cmd/background.go#L15 before actually reading the config file.
Bug description
Basically, if we try to use a custom config, say at
$HOME/custom/config.toml
and we also define apath_prefix
in the config, say at$HOME/custom/jtv
. It still tries to create a folder (though empty) at$HOME/.jiotv_go
.Steps to reproduce
$HOME/.jiotv_go
folder to somewhere else, say at$HOME/custom
.$HOME/custom/jiotv_go.toml
and setpath_prefix
to$HOME/custom
.$HOME/.jiotv_go
is not present.Run JioTV Go with
--config
param set to$HOME/custom/jiotv_go.toml
:-$HOME/custom
as its path prefix, it also creates an empty folder at$HOME/.jiotv_go
.Relevant log output
Screenshots or videos
No response
Solution
The problem is basically in https://github.com/rabilrbl/jiotv_go/blob/f34465e7fb35ed80c73306367ee1b7e20aa1dbb7/pkg/store/store.go#L118
Somehow this method runs before the custom config is actually read and
path_prefix
is parsed.Additional context
No response
Acknowledgements