Fixed circular dependency issue

This commit is contained in:
Pijus Kamandulis
2020-03-22 00:22:08 +02:00
parent f9d35e3bf2
commit af7972685e
8 changed files with 21 additions and 15 deletions

View File

@@ -3,6 +3,7 @@ package utils
import (
models "../models"
config "../models/config"
fileio "./fileio"
log "./log"
)
@@ -18,7 +19,7 @@ func IsItemInArchive(upload models.Upload) bool {
func RemoveArchivedItems(uploads []models.Upload) []models.Upload {
archiveFilePath := config.Config.ArchiveFilePath
if archiveFilePath == "" || !CheckIfExists(archiveFilePath) {
if archiveFilePath == "" || !fileio.CheckIfExists(archiveFilePath) {
return uploads
}
@@ -31,7 +32,7 @@ func RemoveArchivedItems(uploads []models.Upload) []models.Upload {
}
lenBeforeRemoval := len(uploads)
ReadFileLineByLine(archiveFilePath, removeArchivedItemsDelegate)
fileio.ReadFileLineByLine(archiveFilePath, removeArchivedItemsDelegate)
removedCount := lenBeforeRemoval - len(uploads)
if removedCount > 0 {
@@ -49,5 +50,5 @@ func AddItemToArchive(uploadID string) {
return
}
AppendToFile(uploadID, archiveFilePath)
fileio.AppendToFile(uploadID, archiveFilePath)
}

View File

@@ -5,7 +5,7 @@ import (
"io/ioutil"
"os"
checkErr "./checkErr"
checkErr "../checkErr"
)
type delegateString func(string)