Clean up some code -- reorganize some structs and unexport some consts.

This commit is contained in:
Eugene Bujak
2018-11-27 20:51:12 +03:00
parent ec7efcc9d6
commit 6cb991fe7f
3 changed files with 31 additions and 35 deletions

View File

@@ -659,7 +659,7 @@ func (filter *filter) update(force bool) (bool, error) {
return true, nil
}
// saves filter contents to the file in config.ourDataDir
// saves filter contents to the file in dataDir
func (filter *filter) save() error {
filterFilePath := filter.Path()
log.Printf("Saving filter %d contents to: %s", filter.ID, filterFilePath)
@@ -672,7 +672,7 @@ func (filter *filter) save() error {
return nil
}
// loads filter contents from the file in config.ourDataDir
// loads filter contents from the file in dataDir
func (filter *filter) load() error {
if !filter.Enabled {
// No need to load a filter that is not enabled
@@ -704,7 +704,7 @@ func (filter *filter) load() error {
// Path to the filter contents
func (filter *filter) Path() string {
return filepath.Join(config.ourBinaryDir, config.ourDataDir, FiltersDir, strconv.FormatInt(filter.ID, 10)+".txt")
return filepath.Join(config.ourBinaryDir, dataDir, filterDir, strconv.FormatInt(filter.ID, 10)+".txt")
}
// ------------